New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid asset filename messsage #1369

Closed
lhoracek opened this Issue Nov 22, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@lhoracek

Information

  1. Version 2.2.1
  2. Mac
  3. Build myself

Asset files in our app often contain locale specific characters. During development, we did not have any problem with that. But our ops team tried decoding apk to change version and version name and rebuilding again and they get error.
ApkTool obviously validates filenames in assets as well and should not do that.

Stacktrace/Logcat

W: /Users/user/Temp/apktool/App_1.0.2_13_10002013-prod-release/assets/pdf/education/directory/PdfFilenameéUnicodeChar.pdf: error: Invalid filename.  Unable to add.
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/q_/t31gmn4j5g56jfqykyfhc0202sk4j9/T/brut_util_Jar_1904785156313027405.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 22, --version-code, 10002013, --version-name, 1.0.2, -F, /Users/user/Temp/apktool/App_1.0.2_13_10002013-prod-release/dist/App_1.0.2_13_10002013-prod-release.apk, -0, arsc, -0, arsc, -A, /Users/user/Temp/apktool/App_1.0.2_13_10002013-prod-release/assets, /Users/user/Temp/apktool/App_1.0.2_13_10002013-prod-release/build/apk]
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:439)
	at brut.androlib.Androlib.buildApk(Androlib.java:675)
	at brut.androlib.Androlib.build(Androlib.java:315)
	at brut.androlib.Androlib.build(Androlib.java:264)
	at brut.apktool.Main.cmdBuild(Main.java:227)
	at brut.apktool.Main.main(Main.java:84)
Caused by: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/q_/t31gmn4j5g56jfqykyfhc0202sk4j9/T/brut_util_Jar_1904785156313027405.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 22, --version-code, 10002013, --version-name, 1.0.2, -F, /Users/user/Temp/apktool/App_1.0.2_13_10002013-prod-release/dist/App_1.0.2_13_10002013-prod-release.apk, -0, arsc, -0, arsc, -A, /Users/user/Temp/apktool/App_1.0.2_13_10002013-prod-release/assets, /Users/user/Temp/apktool/App_1.0.2_13_10002013-prod-release/build/apk]
	at brut.util.OS.exec(OS.java:95)
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:433)


Steps to Reproduce

  1. Create app with asset files using unicode characters as filenames
  2. Decode
  3. Build again

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)

APK

Apk cannot be shared

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? Yes i have, that is part of steps to reproduce
  2. Didnt come this far
  3. Yes
@lhoracek

This comment has been minimized.

Show comment
Hide comment
@lhoracek

lhoracek Nov 22, 2016

I can see in the sources, that this is more likely aapt issue. Will try updating to newer aapt from build tools 25

I can see in the sources, that this is more likely aapt issue. Will try updating to newer aapt from build tools 25

@lhoracek

This comment has been minimized.

Show comment
Hide comment
@lhoracek

lhoracek Nov 30, 2016

Not working even with aapt form build-tools v25

Not working even with aapt form build-tools v25

iBotPeaches added a commit that referenced this issue Dec 2, 2016

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Dec 2, 2016

Owner

This is another problem with aapt. I started work a few days on some aapt patches. We have too many patches in aapt at this point to make sense of them all, so trying to do this correctly this time around.

Working on tons of internal documentation for building apktool flavored aapt binaries, so the turn around time for building multiple platform binaries is much quicker. I assume OEMs and more get around this by patching the apk with some build scripts after the fact or simply use old aapt versions.

Nothing to report yet, but tons of these bugs are aapt's fault.

Owner

iBotPeaches commented Dec 2, 2016

This is another problem with aapt. I started work a few days on some aapt patches. We have too many patches in aapt at this point to make sense of them all, so trying to do this correctly this time around.

Working on tons of internal documentation for building apktool flavored aapt binaries, so the turn around time for building multiple platform binaries is much quicker. I assume OEMs and more get around this by patching the apk with some build scripts after the fact or simply use old aapt versions.

Nothing to report yet, but tons of these bugs are aapt's fault.

@iBotPeaches iBotPeaches added this to the 2.2.2 - Bug Fixes milestone Dec 24, 2016

iBotPeaches added a commit that referenced this issue Dec 24, 2016

Ignore filename checks to allow unicode filenames
 - fixes #1369
 - aapt binaries for mac osx
@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Dec 24, 2016

Owner

PR is open. Only have my laptop on me for this little holiday break so can't build the unix/windows binaries until back home but the upstream patch to our frameworks/base project here - iBotPeaches/platform_frameworks_base@7cc18d9

Seems to have worked for my re-enabled unit test for unicode asset filenames.

Owner

iBotPeaches commented Dec 24, 2016

PR is open. Only have my laptop on me for this little holiday break so can't build the unix/windows binaries until back home but the upstream patch to our frameworks/base project here - iBotPeaches/platform_frameworks_base@7cc18d9

Seems to have worked for my re-enabled unit test for unicode asset filenames.

@iBotPeaches iBotPeaches closed this in #1392 Dec 29, 2016

iBotPeaches added a commit that referenced this issue Dec 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment