Apktool: [BUG] Can't compile WhatsApp: No resource identifier found for attribute
Information
- Apktool Version (
apktool -version
) - 2.7.1-2b8121-SNAPSHOT (also tried 2.7.0) - Operating System (Mac, Linux, Windows) - Linux
- APK From? (Playstore, ROM, Other) - Playstore
- Java Version (
java --version
) - openjdk 11.0.19 2023-04-18
Description
I tried to re-compile WhatsApp, but this time I get the following errors. It worked for years, but now they seem to have changed something with their resource packer. The unpacked files are correct though, JADX is giving me the same XMLs. I found the issue #1663 that seems to be a duplicate, but I got confused about the answers, just like some others in the comments. Why does this happen? Does the attribute have a different, obfuscated name that I can find out and replace manually?
Stacktrace using aapt1:
I: Building resources...
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/animator/APKTOOL_DUMMYVAL_0x7f02000b.xml:7: error: No resource identifier found for attribute 'state_dragged' in package 'com.whatsapp'
W:
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/animator/APKTOOL_DUMMYVAL_0x7f02000c.xml:7: error: No resource identifier found for attribute 'state_dragged' in package 'com.whatsapp'
W:
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/animator/APKTOOL_DUMMYVAL_0x7f020016.xml:4: error: No resource identifier found for attribute 'state_dragged' in package 'com.whatsapp'
W:
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/drawable/mtrl_switch_thumb.xml:6: error: No resource identifier found for attribute 'state_with_icon' in package 'com.whatsapp'
W:
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/color/APKTOOL_DUMMYVAL_0x7f06064e.xml:5: error: No resource identifier found for attribute 'state_dragged' in package 'com.whatsapp'
W:
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/color/APKTOOL_DUMMYVAL_0x7f06084a.xml:5: error: No resource identifier found for attribute 'state_dragged' in package 'com.whatsapp'
W:
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/color/APKTOOL_DUMMYVAL_0x7f06084a.xml:6: error: No resource identifier found for attribute 'state_dragged' in package 'com.whatsapp'
W:
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/color/APKTOOL_DUMMYVAL_0x7f06084b.xml:5: error: No resource identifier found for attribute 'state_dragged' in package 'com.whatsapp'
W:
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_100789196559354913966323838559374761553.tmp, p, --forced-package-id, 127, --min-sdk-version, 23, --version-code, 231278007, --version-name, 2.23.12.78, --no-version-vectors, -F, /tmp/APKTOOL7347569595200723227.tmp, -e, /tmp/APKTOOL3147889887535317417.tmp, -0, arsc, -I, /home/andre/.local/share/apktool/framework/1.apk, -S, /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res, -M, /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/AndroidManifest.xml]
Stacktrace using aapt2:
I: Building resources...
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/animator/APKTOOL_DUMMYVAL_0x7f02000b.xml:7: error: attribute state_dragged (aka com.whatsapp:state_dragged) not found.
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/animator/APKTOOL_DUMMYVAL_0x7f02000c.xml:7: error: attribute state_dragged (aka com.whatsapp:state_dragged) not found.
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/animator/APKTOOL_DUMMYVAL_0x7f020016.xml:4: error: attribute state_dragged (aka com.whatsapp:state_dragged) not found.
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/color/APKTOOL_DUMMYVAL_0x7f06064e.xml:5: error: attribute state_dragged (aka com.whatsapp:state_dragged) not found.
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/color/APKTOOL_DUMMYVAL_0x7f06084a.xml:5: error: attribute state_dragged (aka com.whatsapp:state_dragged) not found.
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/color/APKTOOL_DUMMYVAL_0x7f06084a.xml:6: error: attribute state_dragged (aka com.whatsapp:state_dragged) not found.
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/color/APKTOOL_DUMMYVAL_0x7f06084b.xml:5: error: attribute state_dragged (aka com.whatsapp:state_dragged) not found.
W: /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/res/drawable/mtrl_switch_thumb.xml:6: error: attribute state_with_icon (aka com.whatsapp:state_with_icon) not found.
W: error: failed linking file resources.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_66861882540706906105295532666519204475.tmp, link, -o, /tmp/APKTOOL16193917248874868592.tmp, --package-id, 127, --min-sdk-version, 23, --version-code, 231278007, --version-name, 2.23.12.78, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, -e, /tmp/APKTOOL864166811073607284.tmp, -0, arsc, -I, /home/andre/.local/share/apktool/framework/1.apk, --manifest, /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/AndroidManifest.xml, /home/andre/Programme/APKTool/Fixes/Apktool/WhatsApp/build/resources.zip]
Steps to Reproduce
- Decompile latest WhatsApp (including resources)
- Try to recompile it
APK
WhatsApp 2.23.12.78 from Google Play Store. I’d rather not re-upload it for legal reasons.
Questions to ask before submission
- Have you tried
apktool d
,apktool b
without changing anything? Yes - If you are trying to install a modified apk, did you resign it? It’s Not compiling
- Are you using the latest apktool version? Yes
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 23 (4 by maintainers)
@iBotPeaches thank for the hint i see after quite time of search i found that the issue is i need to add this 2 lines to the attrs.xml
<attr name="state_dragged" format="boolean" />
<attr name="state_with_icon" format="boolean" />
still didnt figure out what part of the code does this job but i get this soultion for now but still failed to build with this error
AndroidManifest.xml:82: error: Error: Integer types not allowed (at 'usesPermissionFlags' with value '0x00010000').
not quite getting why this error happens
i removed the line but still got other errors the good thing its 1 error
res/values-v31/colors.xml:3: error: Error: No resource found that matches the given name (at 'APKTOOL_DUMMYVAL_0x7f0606a0' with value '@android:color/Teal_700')
@andrewille here a fix for the errors for now add these 2 lines to attrs.xml and if u get the error in androidmanifest just delete the lines
if i found anymore solution i will update u with details
@linuxct - Attributes/properties did have some flaws. Upcoming release takes an aim at many of those:
Just waiting on AOSP Android 14 sources to add the new qualifiers and I’ll release 2.9.0
I have never attempted to rename it, but you could try to set a different name in the apktool.yml. Change renameManifestPackage inside packageInfo to a string with a different name. But as I said, I never tried it so idk if it works. But as mentioned in #3011, this might need further changes in the code because it will rename the package but not change the code so this still references the old packages.
Maybe there’s a simpler solution, but I think I can’t help you with it
@byomi - This repo has had more activity from myself in the past 2 weeks than the last 4 years combined - so yes plenty of updates, but nothing for this ticket.
The best hint I have is looking at the AXML parser between the namespace association and how it handles with value comparisons between the string pool and resource table.
Its always good behavior to decode an application again with a newer apktool in case it was decoded improperly prior.