DexPatcher / dexpatcher-gradle

Modify Android applications at source-level in Android Studio
https://dexpatcher.github.io/
GNU General Public License v3.0
84 stars 17 forks source link

APKTOOL_DUMMY_28 #27

Closed ahmadii closed 5 years ago

ahmadii commented 5 years ago

Hi, I've decoded an apk and the following line is adding to the plurals.xml file

<item type="plurals" name="APKTOOL_DUMMY_28">false</item>

why this is happening? please note that the apk file doesn't have this line in plurals.xml.

Lanchon commented 5 years ago

the apk file doesn't have this line in plurals.xml

how do you know? you checked the source code of every library the apk source code brings in, including the android support libs, etc?

i suppose this is normal apktool behaviour given some kind of strange or malformed resource. ask the apktool project. or better yet, search; i am sure it is covered somwhere.

ahmadii commented 5 years ago

how do you know? I extracted the resources file from apk and found out plurals.xml has all the same lines just except the mentioned one. so you mean that it's a problem with apktool project. thanks

Lanchon commented 5 years ago

it's either a problem with the APK or with apktool.

i googled. seems like android's binary XML format is somehow positional. so when a resource can't be decoded, a placeholder entry still has to be injected in the build; these are the generated APKTOOL_DUMMY_<n> values. use dexpatcher.apktool.keepBrokenResources = true, or whatever that option is called, to see what exactly is wrong with the APK or apktool. the result shouldn't build, but it might give you better errors.

ahmadii commented 5 years ago

it's either a problem with the APK or with apktool.

APK is OK. its https://play.google.com/store/apps/details?id=com.xiaomi.hm.health&hl=en I also used decodeApk.keepBrokenResources = true but it's not working I also use apktool.bat d MiFit_4.0.10.apk --keep-broken-res and it's not working either

Lanchon commented 5 years ago

don't assume the app is Ok. there are plenty of apps with invalid resources in the play store.

also, i don't know what you mean with "not working". i suggested using keepBrokenResources so you can investigate what resources are problematic. (apktool otherwise strip them.) with this option generating broken resources you most definitely won't be able to rebuild the app.

anyway, this is an resource decompilation issue. you should file a complete bug with apktool. if you cant make a successful roundtrip using apktool, you'll face the same issues with dxp.

ahmadii commented 5 years ago

Decompilation doesn't raise any error. I made an issue with the stack-trace in APKTOOLS repository about it. I'm waiting for the response. I've downloaded a modded MiFit app before. so it means that somebody modified it before and it has a solution.

Lanchon commented 5 years ago

Decompilation doesn't raise any error.

i did not say that. i expect apktool would produce broken resources that cannot be rebuilt. but yeah, apktool is the right project.