ax / apk.sh

apk.sh makes reverse engineering Android apps easier, automating some repetitive tasks like pulling, decoding, rebuilding and patching an APK.
GNU General Public License v3.0
3.34k stars 189 forks source link

[BUG] missing 'name' attribute in res/values xml files #35

Open CrazyChaoz opened 7 months ago

CrazyChaoz commented 7 months ago

Information

  1. apk.sh version : 1.0.8
  2. Operating System (Mac, Linux, Windows) : Linux
  3. APK From? (Playstore, ROM, Other) : Playstore

More Accurate Description

in the affected resource files there is a (seemingly) arbitrary number of xml tags (usually) at the end, within the <resources> with the following structure: <item type=\"\S*\" name=\"\" \/>

some files have none of the empty name tag tags, some have just them, and most have something in between

in public.xml is the tag different, there it is <public type=\"\S*\" name=\"\" id=\"\S*\" \/>

apk.sh output

[>] Building with java -jar /home/my-user/.apk.sh/apktool_2.9.3.jar b -d  com.attidomobile.passwallet_split_apks/base -o file.apk --use-aapt2
I: Using Apktool 2.9.3
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
I: Using aapt2 - setting 'debuggable' attribute to 'true' in AndroidManifest.xml
W: /home/my-user/apk.sh/com.attidomobile.passwallet_split_apks/base/res/values/public.xml:6934: error: <public> missing 'name' attribute.
W: /home/my-user/apk.sh/com.attidomobile.passwallet_split_apks/base/res/values/public.xml:6935: error: <public> missing 'name' attribute.
W: /home/my-user/apk.sh/com.attidomobile.passwallet_split_apks/base/res/values/public.xml: error: file failed to compile.
W: /home/my-user/apk.sh/com.attidomobile.passwallet_split_apks/base/res/values/strings.xml:655: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.attidomobile.passwallet_split_apks/base/res/values/strings.xml:656: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.attidomobile.passwallet_split_apks/base/res/values/strings.xml: error: file failed to compile.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_130762370632719210017057457644154483351.tmp, compile, --dir, /home/my-user/apk.sh/com.attidomobile.passwallet_split_apks/base/res, --legacy, -o, /home/my-user/apk.sh/com.attidomobile.passwallet_split_apks/base/build/resources.zip]
[>] Sorry!
[!] java -jar /home/my-user/.apk.sh/apktool_2.9.3.jar b -d  com.attidomobile.passwallet_split_apks/base -o file.apk --use-aapt2 return errors!
[>] Bye!

or

[>] Building with java -jar /home/my-user/.apk.sh/apktool_2.9.3.jar b -d  com.google.android.apps.walletnfcrel_split_apks/base -o file.single.apk --use-aapt2 
I: Using Apktool 2.9.3
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: Using aapt2 - setting 'debuggable' attribute to 'true' in AndroidManifest.xml
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml:3: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml:4: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml:5: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml:6: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml:7: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml:8: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml:9: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml:10: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml:11: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml:12: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/animators.xml: error: file failed to compile.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/anims.xml:3: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/anims.xml:4: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/anims.xml:5: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/anims.xml:6: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/anims.xml:7: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/anims.xml:8: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/anims.xml:9: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/anims.xml:10: error: <item> missing 'name' attribute.
W: /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res/values/anims.xml:11: error: <item> missing 'name' attribute.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_22534173162893068579221351672871164782.tmp, compile, --dir, /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/res, --legacy, -o, /home/my-user/apk.sh/com.google.android.apps.walletnfcrel_split_apks/base/build/resources.zip]
[>] Sorry!
[!] java -jar /home/my-user/.apk.sh/apktool_2.9.3.jar b -d  com.google.android.apps.walletnfcrel_split_apks/base -o file.single.apk --use-aapt2  return errors!
[>] Bye!

Steps to Reproduce

  1. pull an affected app
  2. watch apk.sh/apktool die

APK

I had issues with

Local Fix

Manually remove the affected lines (?) and try to rebuild until no errors pop up anymore The apps were able to be built, but there were internal issues (This might also be an issue with apktool --resource-mode dummy, idk for sure)

ax commented 7 months ago

Hi @CrazyChaoz! Thanks for reporting the issue! Do you have news about it?

raxod502 commented 6 months ago

I see similar errors with the com.ttxapps.megasync apk version 6.3.11 from Google Play:

W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:4573: error: expected enum but got (raw string) 0.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:4578: error: expected enum but got (raw string) 0.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:4580: error: expected enum but got (raw string) 1.
W: /home/raxod502/scratch/megasync-6.3.11/res/values-sw600dp/styles.xml:5: error: expected enum but got (raw string) 1.
W: /home/raxod502/scratch/megasync-6.3.11/res/values-land/styles.xml:5: error: expected enum but got (raw string) 1.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:4689: error: expected enum but got (raw string) 1.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:5383: error: expected enum but got (raw string) 3.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:5420: error: expected enum but got (raw string) 3.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:5487: error: expected enum but got (raw string) 1.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:5682: error: expected enum but got (raw string) 1.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:5718: error: expected enum but got (raw string) 1.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:5801: error: expected enum but got (raw string) 1.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:5815: error: expected enum but got (raw string) 1.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:5976: error: expected enum but got (raw string) 3.
W: /home/raxod502/scratch/megasync-6.3.11/res/values/styles.xml:5987: error: expected enum but got (raw string) 3.
W: error: failed linking references.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_170920648060031385601512344811055241028.tmp, link, -o, /tmp/APKTOOL5949621063467434960.tmp, --package-id, 127, --min-sdk-version, 21, --target-sdk-version, 34, --version-code, 24030810, --version-name, 6.3.11, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, --no-compile-sdk-metadata, --warn-manifest-validation, -e, /tmp/APKTOOL7349574061716970862.tmp, -0, arsc, -I, /home/raxod502/.local/share/apktool/framework/1.apk, --manifest, /home/raxod502/scratch/megasync-6.3.11/AndroidManifest.xml, /home/raxod502/scratch/megasync-6.3.11/build/resources.zip]