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] Recompiling system jars produces strange jars

taylor00541 opened this issue · comments

Information

  1. Apktool Version (apktool -version) - 2.9.3
  2. Operating System (Mac, Linux, Windows) - Windows 11
  3. APK From? (Playstore, ROM, Other) - ROM
  4. Java Version (java --version) - java 20.0.1 2023-04-18

Steps to Reproduce

  1. Download lineage-20.0-20240126-nightly-lynx-signed.zip from here.
  2. Extract system.img from the OTA, and then get /system/framework/framework.jar (framework.jar.zip)
  3. apktool d -o framework framework.jar
  4. apktool b -api 29 -c -f -o framework2.jar ./framework
  5. Note that framework.jar is 32.6 MB and framework2.jar is 17.6 MB
  6. Run unzip -lv framework.jar, unzip -lv framework2.jar Note that framework.jar contains 57 files, and framework2.jar contains 54 files (missing res/vendor.mime.types, res/android.mime.types, res/debian.mime.types).
  7. Note that the checksums of all the .dex files have changed.
  8. Replacing the produced file on a running ROM causes a boot loop.
  9. The same holds for other system .jars.

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? Irrelevant
  3. Are you using the latest apktool version? Yes

Possibly related issues

  1. #2918
  2. #2662

hmm thats odd. Thanks for details.

I'm watching some updates to upstream smail for newer dex types. Though you are targeting API 29, so probably that. Either way you might have some luck running some tests directly w/ smali to rule out specific Apktool beahvior.

https://github.com/google/smali

Going to mark as 3rd-party and await a new release from google/smali. I believe whatever is happening here is over my knowledge.