Apktool: apktool 2.4.1 error in resource packing

Created on 14 Jan 2020  Â·  19Comments  Â·  Source: iBotPeaches/Apktool

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

Most helpful comment

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.

All 19 comments

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.

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

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.

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)

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

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.?

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.

Thanks a lot for solving my issue.

That's not a problem at all. :)

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.

What sort of activity are you trying to inject?

I actually injection metasploit payload.

On Fri, 17 Jan 2020, 12:03 am Ticklefish, notifications@github.com wrote:

What sort of activity are you trying to inject?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/iBotPeaches/Apktool/issues/2278?email_source=notifications&email_token=AISTJLQDTBQBIW6Y5XLT35LQ6CR6LA5CNFSM4KGUONDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJFCMYA#issuecomment-575284832,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AISTJLUKJ27NS4UMYYBGYELQ6CR6LANCNFSM4KGUONDA
.

Cool. What's that for?

Can you add Toast messages es file explorer I mean user should get a toast
message when he will open es file explorer.

On Fri, 17 Jan 2020, 5:42 pm Ticklefish, notifications@github.com wrote:

Cool. What's that for?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/iBotPeaches/Apktool/issues/2278?email_source=notifications&email_token=AISTJLUB4Z65WEZIWOKRGILQ6GODDA5CNFSM4KGUONDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJHP5II#issuecomment-575602337,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AISTJLQK6JWDCUUEPI73MM3Q6GODDANCNFSM4KGUONDA
.

Intriguing.

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

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

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.

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

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

Closing.

Was this page helpful?
0 / 5 - 0 ratings