Apktool
Apktool copied to clipboard
Arbitrary resource names with periods cause failure to reassemble
Information
- Apktool Version (
apktool -version
) - 2.3.4 - Operating System (Mac, Linux, Windows) - Linux
- APK From? (Playstore, ROM, Other) - Sample app demonstrating problems in other apps
Stacktrace/Logcat
I: Building resources...
W: /root/Desktop/test/dottednametest/res/values/arrays.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'com.sampleapp.arrays.init'.
Steps to Reproduce
- Create a dummy sample app that includes a resource using periods in the name, as such:
- One.1
- Two.2
- Three.3
- Four.4
- Five.5
- Disassemble the app with apktool d and try to reassemble with apktool b, and it will fail.
It appears the reassembly presumes that because the resource name contains periods in the string, that it is part of some hierarchy (i.e. has a parent), when in fact it is nothing more than an arbitrary name. This name IS allowed when building in Android Studio.
APK
If this APK can be freely shared, please upload/attach a link to it. dottednametest.zip
Debug APK is included inside the attached ZIP file.
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? N/A, won't rebuild
- Are you using the latest apktool version? YES
Sorry, initial post didn't properly demonstrate the resource name:
<string-array name="com.sampleapp.arrays.init.values">
testapp-orig/res/values-mcc001/arrays.xml:38: error: Error retrieving parent for item: No resource found that matches the given name 'values.issue'.
Confirmed with new test example. What a weird bug.
Hi all, just a small note, that this nasty issue is still reproducible.
Yes, I confirm this bug is still present
As a workaround, assuming you don't need to mess around with resources, when decompiling use -r option:
apktool d -r some.apk
It won't touch them and leave in raw state.