Skip to content
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

apktool 2.4.1 error in resource packing #2278

Closed
theamanrawat opened this issue Jan 14, 2020 · 19 comments
Closed

apktool 2.4.1 error in resource packing #2278

theamanrawat opened this issue Jan 14, 2020 · 19 comments

Comments

@theamanrawat
Copy link

Information

  1. Apktool Version (apktool -version) - 2.4.1
  2. Operating System (Mac, Linux, Windows) - Windows
  3. APK From? (Playstore, ROM, Other) - https://es-file-explorer.en.uptodown.com/android/download

Stacktrace/Logcat

I: Using Apktool 2.4.1
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Smaling smali_classes3 folder into classes3.dex...
I: Building resources...
W: C:\Users\rawat\Desktop\aman1\esfile\res\values\public.xml:2940: error: resource 'drawable/$avd_hide_password__0' has invalid entry name '$avd_hide_password__0'. Invalid character '$avd_hide_password__0'.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values\public.xml:2941: error: resource 'drawable/$avd_hide_password__1' has invalid entry name '$avd_hide_password__1'. Invalid character '$avd_hide_password__1'.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values\public.xml:2942: error: resource 'drawable/$avd_hide_password__2' has invalid entry name '$avd_hide_password__2'. Invalid character '$avd_hide_password__2'.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values\public.xml:2943: error: resource 'drawable/$avd_show_password__0' has invalid entry name '$avd_show_password__0'. Invalid character '$avd_show_password__0'.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values\public.xml:2944: error: resource 'drawable/$avd_show_password__1' has invalid entry name '$avd_show_password__1'. Invalid character '$avd_show_password__1'.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values\public.xml:2945: error: resource 'drawable/$avd_show_password__2' has invalid entry name '$avd_show_password__2'. Invalid character '$avd_show_password__2'.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values\public.xml:2953: error: resource 'drawable/$ic_launcher_foreground__0' has invalid entry name '$ic_launcher_foreground__0'. Invalid character '$ic_launcher_foreground__0'.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values-v21\styles.xml:78: error: expected reference but got (raw string) true.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values-v21\styles.xml:87: error: expected reference but got (raw string) true.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values-v21\styles.xml:100: error: expected dimension but got (raw string) true.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values-v21\styles.xml:104: error: expected reference but got (raw string) true.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values-v21\styles.xml:105: error: expected reference but got (raw string) false.
W: C:\Users\rawat\Desktop\aman1\esfile\res\values-v21\styles.xml:113: error: expected float but got (raw string) 3.0dip.
W: error: failed linking references.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\rawat\AppData\Local\Temp\brut_util_Jar_4032101392738594028.tmp, link, -o, C:\Users\rawat\AppData\Local\Temp\APKTOOL3975565721024851697.tmp, --package-id, 127, --min-sdk-version, 17, --target-sdk-version, 26, --version-code, 10058, --version-name, 4.2.1.9, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, -e, C:\Users\rawat\AppData\Local\Temp\APKTOOL620741681139156457.tmp, -0, arsc, -I, C:\Users\rawat\AppData\Local\apktool\framework\1.apk, --manifest, C:\Users\rawat\Desktop\aman1\esfile\AndroidManifest.xml, C:\Users\rawat\Desktop\aman1\esfile\build\resources.zip]

Steps to Reproduce

  1. apktool d esfile.apk
  2. apktool b esfile.apk

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? Yes
  2. If you are trying to install a modified apk, did you resign it? nill
  3. Are you using the latest apktool version? Yes
@iBotPeaches
Copy link
Owner

apktool 2.4.1 error and this tool really needs to improve.

You know its open source and free right? You are welcome to contribute.

@theamanrawat
Copy link
Author

Yes I know but can you tell me why this issue is occurring??

@theamanrawat theamanrawat changed the title apktool 2.4.1 error and this tool really needs to improve. apktool 2.4.1 error in resource packing Jan 14, 2020
@Ticklefish
Copy link

I tried your file, installing AOSP framework-res.apk, and using aapt2 to get this:

(java -Xmx1024m -jar user_files\APKTOOL\apktool_2.4.1.jar d --force-manifest --only-main-classes -f -p _WorkArea1\Frameworks _WorkArea1_in\es-file-explorer-4-2-1-9.apk -o _WorkArea1_working\es-file-explorer-4-2-1-9.apk)

I: Using Apktool 2.4.1 on es-file-explorer-4-2-1-9.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: _WorkArea1\Frameworks\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values / XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes3.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

(java -jar user_files\APKTOOL\apktool_2.4.1.jar b --copy-original --force-all --use-aapt2 -p _WorkArea1\Frameworks _WorkArea1_working\es-file-explorer-4-2-1-9.apk -o _WorkArea1_out\es-file-explorer-4-2-1-9.apk)

-c/--copy-original has been deprecated. Removal planned for v2.5.0 (#2129)
I: Using Apktool 2.4.1
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Smaling smali_classes3 folder into classes3.dex...
I: Building resources...
W: C:\TickleMyAndroid_WorkArea1_working\es-file-explorer-4-2-1-9.apk\res\values\public.xml:2940: error: resource 'drawable/$avd_hide_password__0' has invalid entry name '$avd_hide_password__0'. Invalid character '$avd_hide_password__0'.
W: C:\TickleMyAndroid_WorkArea1_working\es-file-explorer-4-2-1-9.apk\res\values\public.xml:2941: error: resource 'drawable/$avd_hide_password__1' has invalid entry name '$avd_hide_password__1'. Invalid character '$avd_hide_password__1'.
W: C:\TickleMyAndroid_WorkArea1_working\es-file-explorer-4-2-1-9.apk\res\values\public.xml:2942: error: resource 'drawable/$avd_hide_password__2' has invalid entry name '$avd_hide_password__2'. Invalid character '$avd_hide_password__2'.
W: C:\TickleMyAndroid_WorkArea1_working\es-file-explorer-4-2-1-9.apk\res\values\public.xml:2943: error: resource 'drawable/$avd_show_password__0' has invalid entry name '$avd_show_password__0'. Invalid character '$avd_show_password__0'.
W: C:\TickleMyAndroid_WorkArea1_working\es-file-explorer-4-2-1-9.apk\res\values\public.xml:2944: error: resource 'drawable/$avd_show_password__1' has invalid entry name '$avd_show_password__1'. Invalid character '$avd_show_password__1'.
W: C:\TickleMyAndroid_WorkArea1_working\es-file-explorer-4-2-1-9.apk\res\values\public.xml:2945: error: resource 'drawable/$avd_show_password__2' has invalid entry name '$avd_show_password__2'. Invalid character '$avd_show_password__2'.
W: C:\TickleMyAndroid_WorkArea1_working\es-file-explorer-4-2-1-9.apk\res\values\public.xml:2953: error: resource 'drawable/$ic_launcher_foreground__0' has invalid entry name '$ic_launcher_foreground__0'. Invalid character '$ic_launcher_foreground__0'.
I: Copying libs... (/lib)
I: Copy original files...
I: Copy AndroidManifest.xml...
I: Copy META-INF...
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...

This issue with the dollar character in the filename is due to aapt2 and can be fixed but I can recompile without using aapt2 instead, giving me this:

(java -jar user_files\APKTOOL\apktool_2.4.1.jar b --copy-original --force-all -p _WorkArea1\Frameworks _WorkArea1_working\es-file-explorer-4-2-1-9.apk -o _WorkArea1_out\es-file-explorer-4-2-1-9.apk)

-c/--copy-original has been deprecated. Removal planned for v2.5.0 (#2129)
I: Using Apktool 2.4.1
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Smaling smali_classes3 folder into classes3.dex...
I: Building resources...
W: fakeLogOpen(/dev/log_stats) failed
W: fakeLogOpen(/dev/log_stats) failed
I: Copying libs... (/lib)
I: Copy original files...
I: Copy AndroidManifest.xml...
I: Copy META-INF...
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...

The file was recompiled without any problem.

@theamanrawat
Copy link
Author

theamanrawat commented Jan 15, 2020

How you installed framework-res.apk I can see in command that You used the same apk as a framework it it true?

(java -jar user_files\APKTOOL\apktool_2.4.1.jar b --copy-original --force-all -p _WorkArea1\Frameworks _WorkArea1_working\es-file-explorer-4-2-1-9.apk -o _WorkArea1_out\es-file-explorer-4-2-1-9.apk)

@Ticklefish
Copy link

I installed framework-res.apk from Android 10 AOSP.

@theamanrawat
Copy link
Author

can you please tell me in detail that how you installed framework-res.apk from android 10 AOSP.

Like you used apktool command to install framework-res.apk but I want to know that how did you get the framework-res.apk.?

@Ticklefish
Copy link

AOSP_10_framework-res.zip

I got it from a build of stock AOSP that was shared on xda a little while ago. And I've attached it to this post for you.

@theamanrawat
Copy link
Author

Thanks a lot for solving my issue.

@Ticklefish
Copy link

That's not a problem at all. :)

@theamanrawat
Copy link
Author

Hi @Ticklefish I want to ask one more query regarding reverse engineering that I want to inject my own app activity in es file explorer but unable to do that.

@Ticklefish
Copy link

What sort of activity are you trying to inject?

@theamanrawat
Copy link
Author

theamanrawat commented Jan 17, 2020 via email

@Ticklefish
Copy link

Cool. What's that for?

@theamanrawat
Copy link
Author

theamanrawat commented Jan 17, 2020 via email

@Ticklefish
Copy link

Intriguing.

I can't help with that, sorry. It's not something I know much about. Best of luck!

@theamanrawat
Copy link
Author

Hi @Ticklefish and @iBotPeaches ,

I: Using Apktool 2.4.1 on hello.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Invalid chunk type: expected=0x00000200, got=0x00000203
        at brut.androlib.res.decoder.ARSCDecoder.checkChunkType(ARSCDecoder.java:542)
        at brut.androlib.res.decoder.ARSCDecoder.readTablePackage(ARSCDecoder.java:88)
        at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:82)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
        at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:786)
        at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:67)
        at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:59)
        at brut.androlib.Androlib.getResTable(Androlib.java:66)
        at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:236)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:118)
        at brut.apktool.Main.cmdDecode(Main.java:170)
        at brut.apktool.Main.main(Main.java:76)

could you please tell me why I can't able to decompile this app using apktool

https://apkpure.com/helo-discover-share-communicate/app.buzz.share

@Ticklefish
Copy link

This appears to be a different issue to the one at the top of this thread..

The APK can't be decompiled because of the way it's constructed - there is a chunk type that isn't what it should be.

To decompile this, you'll need to speak to the developer and ask for their advice.

@fadeevab
Copy link

Hey people,

The issue is not reproduced with the steps in the description.

  1. Apktool Version (apktool --version) - 2.4.1
  2. Operating System - Windows
  3. APK From (Playstore, ROM, Other) - https://es-file-explorer.en.uptodown.com/android/download

See my log:

PS C:\Users\user\Downloads> apktool d .\es-file-explorer-4-2-1-9.apk
I: Using Apktool 2.4.1 on es-file-explorer-4-2-1-9.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\user\AppData\Local\apktool\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes3.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...


PS C:\Users\user\Downloads> apktool b .\es-file-explorer-4-2-1-9
I: Using Apktool 2.4.1
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs... (/lib)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...
PS C:\Users\user\Downloads>

This open issue really misled me cause I wasted a lot time with a bit older apktool thinking the issue is still not fixed.

Best Regards
Alex

@iBotPeaches
Copy link
Owner

Not replicating the issue here, maybe it was the newer version of ES File Explorer.

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants