Invalid asset filename messsage #1369

Closed
lhoracek opened this Issue Nov 22, 2016 · 4 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

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

@lhoracek

Not working even with aapt form build-tools v25

@iBotPeaches iBotPeaches added a commit that referenced this issue Dec 2, 2016
@iBotPeaches Add unit-test (no unicode) 5798c92
@iBotPeaches
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.

@iBotPeaches iBotPeaches added this to the 2.2.2 - Bug Fixes milestone Dec 24, 2016
@iBotPeaches iBotPeaches added a commit that referenced this issue Dec 24, 2016
@iBotPeaches Ignore filename checks to allow unicode filenames
 - fixes #1369
 - aapt binaries for mac osx
b6127d2
@iBotPeaches
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.

@iBotPeaches iBotPeaches closed this in #1392 Dec 29, 2016
@iBotPeaches iBotPeaches added a commit that referenced this issue Dec 29, 2016
@iBotPeaches changelog update for #1394, #1369 13a836e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment