Apktool icon indicating copy to clipboard operation
Apktool copied to clipboard

Arbitrary resource names with periods cause failure to reassemble

Open gizmaniac opened this issue 6 years ago • 5 comments

Information

  1. Apktool Version (apktool -version) - 2.3.4
  2. Operating System (Mac, Linux, Windows) - Linux
  3. 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

  1. 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
  2. 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

  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? N/A, won't rebuild
  3. Are you using the latest apktool version? YES

gizmaniac avatar Jan 04 '19 17:01 gizmaniac

Sorry, initial post didn't properly demonstrate the resource name:

<string-array name="com.sampleapp.arrays.init.values">

gizmaniac avatar Jan 04 '19 18:01 gizmaniac

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.

iBotPeaches avatar Jan 09 '19 23:01 iBotPeaches

Hi all, just a small note, that this nasty issue is still reproducible.

klgsnd avatar Jan 20 '23 17:01 klgsnd

Yes, I confirm this bug is still present

Edivad99 avatar Feb 23 '23 10:02 Edivad99

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.

klgsnd avatar Mar 21 '23 11:03 klgsnd