iBotPeaches / Apktool

A tool for reverse engineering Android apk files

Home Page:https://apktool.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Can't rebuild an apk which misses references

LunaticPoring opened this issue · comments

Information

  1. Apktool Version (apktool -version) - 2.9.3
  2. Operating System (Mac, Linux, Windows) - Windows
  3. APK From? (Playstore, ROM, Other) - Other
  4. Java Version (java --version) - 1.8.0_401

Please excuse my inacuracies as I am not sure how apktools works internally.
It looks like if a resource is missing during decoding, then apktool replaces the value with APKTOOL_MISSING_XXX which makes it not possible to rebuild the same apk (seems to be added here)

Is it possible to provide a default value for missing properties ? Or should I try to manually find and replace the APKTOOL_MISSING with a random string ?

Stacktrace/Logcat

W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:1318: error: expected flags but got (raw string) APKTOOL_MISSING_0x7f080172.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:1334: error: expected flags but got (raw string) APKTOOL_MISSING_0x7f0800f9.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:1369: error: expected flags but got (raw string) APKTOOL_MISSING_0x7f0800f9.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:2540: error: expected enum but got (raw string) 0.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:2542: error: expected enum but got (raw string) 1.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values-sw600dp\styles.xml:4: error: expected enum but got (raw string) 1.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values-sw600dp\styles.xml:5: error: expected enum but got (raw string) 1.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values-land\styles.xml:4: error: expected enum but got (raw string) 1.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values-land\styles.xml:5: error: expected enum but got (raw string) 1.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:2626: error: expected enum but got (raw string) 0.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:2760: error: expected enum but got (raw string) 0.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:2801: error: expected enum but got (raw string) 1.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:2837: error: expected enum but got (raw string) 1.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:2920: error: expected enum but got (raw string) 1.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:2934: error: expected enum but got (raw string) 1.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:3071: error: expected enum but got (raw string) 1.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:3083: error: expected enum but got (raw string) 3.
W: C:\Users\Rems\AppData\Local\Temp\build-apk\res\values\styles.xml:3094: error: expected enum but got (raw string) 3.

Steps to Reproduce

  1. apktool decode target-apk.apk --output build-apk
  2. apktool build build-apk --output target-apk.apk

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)

https://apktool.org/docs/in-depth/resource-modes this should help your understanding of the different resources modes.

Arg, another example of a user not reading the doc.
Sorry for wasting your time and thank you for your help, i will close this