Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Issue with attributes while decompiling, seems like its missing many attributes #3432

Closed
HassanMirza01 opened this issue Nov 20, 2023 · 7 comments

Comments

@HassanMirza01
Copy link

HassanMirza01 commented Nov 20, 2023

Information

  1. Apktool Version (apktool -2.9.0-Snapshot) -
  2. Operating System (Linux) -
  3. APK From? (ROM) -
  4. Java Version (17.0.5 LTS) -

Stacktrace/Logcat

same corrected apk recompiled fine with both aapt1 and aapt2

This with AAPT2 option --use-aapt2,
image

this is with AAPT1 option
image

Include stacktrace here

Steps to Reproduce

  1. just unpack apk and recompile without any edit

Frameworks

https://drive.google.com/drive/folders/1btO62pJ95CIBwZbSu_fSX28zCzsC9Pw-?usp=sharing

APK

https://drive.google.com/file/d/14DRWoHieuwLwNSi9DJ04RPG9P7BinxLm/view?usp=sharing

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? Yes
  3. Are you using the latest apktool version? Yes
@iBotPeaches
Copy link
Owner

This appears to be same issue I disclosed in this comment: #3129 (comment), which in short I believe might be resource shrinking killing an unused resource, but not removing it from all usage.

This is ignored on Android (host), but during rebuild since the source attribute is gone - it fails.


➜  3432 aapt2 d xmltree MiuiSystemUI.apk --file res/drawable/miuix_action_icon_cancel_dark.xml
N: android=http://schemas.android.com/apk/res/android (line=1)
  N: app=http://schemas.android.com/apk/res-auto (line=1)
    E: drawable (line=1)
      A: http://schemas.android.com/apk/res/android:height(0x01010155)=26.000000dp
      A: http://schemas.android.com/apk/res/android:width(0x01010159)=26.000000dp
      A: http://schemas.android.com/apk/res/android:viewportWidth(0x01010402)=26
      A: http://schemas.android.com/apk/res/android:viewportHeight(0x01010403)=26
      A: http://schemas.android.com/apk/res-auto:actionIconDisabledAlpha(0x7f04004f)=0.5
      A: http://schemas.android.com/apk/res-auto:actionIconNormalAlpha(0x7f040050)=0.8
      A: http://schemas.android.com/apk/res-auto:actionIconPressedAlpha(0x7f040051)=0.9
➜  3432 aapt2 d resources MiuiSystemUI.apk| grep 'actionIconDisabledAlpha'
➜  3432 aapt2 d resources MiuiSystemUI.apk| grep 'actionIcon'             
    resource 0x7f0a0052 id/actionIcon

@iBotPeaches iBotPeaches closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2023
@HassanMirza01
Copy link
Author

@iBotPeaches 1 more thing, if i add missing attributes in attr.xml file then it repack apk fine without any issue, with both aapt1 and aapt2, so its only linked to decompile them well with proper values in xml, i saw all those values messed up too in layout xmls which are missing from attrs,

@iBotPeaches
Copy link
Owner

Problem with Apktool though, it can't know a resource is unused till it's done parsing application. It then further would have to rewrite files. It seems that more invocation with aapt2 to dump resources prior (to detect unused) may be best path forward.

@HassanMirza01
Copy link
Author

@iBotPeaches sorry mate, mentioning at wrong place, but 2.9.1 has same issue of that miui related, largeui and godzillaui if i repack with new apktool, when i was compiling 2.9.0 snapshot, it was fine but as i downloaded new 2.9.1. even with --aapt1 usage, those errors are arising, can you confirm if you added that miui patch in 2.9.1?

@iBotPeaches
Copy link
Owner

@HassanMirza01 - I'm not replicating, I confirm the patch is added - a9eacf6

@HassanMirza01
Copy link
Author

HassanMirza01 commented Dec 8, 2023

@HassanMirza01 - I'm not replicating, I confirm the patch is added - a9eacf6

i redownloaded binary and used it again for a fresh unpack/repack, and same result. it was all fine if i compile 2.9.1 from codes.

image

@iBotPeaches
Copy link
Owner

Sorry - as you saw above. I cannot replicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants