iBotPeaches / Apktool

A tool for reverse engineering Android apk files
https://apktool.org/
Apache License 2.0
20.16k stars 3.58k forks source link

BUG :- Apktool Can't recompile Magisk Manager After successfully decompilation #2269

Open Mikesew1320 opened 4 years ago

Mikesew1320 commented 4 years ago

Information

  1. Apktool Version (apktool -version) - 2.4.1
  2. Operating System (Mac, Linux, Windows) - Linux, Windows
  3. APK From? (Playstore, ROM, Other) - From GitHub release page[Open ]

    Stacktrace/Logcat

    I: Using Apktool 2.4.1
    I: Checking whether sources has changed...
    I: Smaling smali folder into classes.dex...
    I: Checking whether resources has changed...
    I: Building resources...
    W: MIKE_Drive/Magisk/res/animator/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f070005.xml:4: error: attribute 'com.topjohnwu.magisk:state_dragged' not found.
    W: MIKE_Drive/Magisk/res/animator-v19/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f070005.xml:4: error: attribute 'com.topjohnwu.magisk:state_dragged' not found.
    W: MIKE_Drive/Magisk/res/animator-v21/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f070000.xml:4: error: attribute 'com.topjohnwu.magisk:state_liftable' not found.
    W: MIKE_Drive/Magisk/res/animator-v21/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f070000.xml:4: error: attribute 'com.topjohnwu.magisk:state_lifted' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b0002.xml:4: error: attribute 'com.topjohnwu.magisk:alpha' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b0003.xml:4: error: attribute 'com.topjohnwu.magisk:alpha' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b0012.xml:4: error: attribute 'com.topjohnwu.magisk:alpha' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b0013.xml:4: error: attribute 'com.topjohnwu.magisk:alpha' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b0014.xml:4: error: attribute 'com.topjohnwu.magisk:alpha' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b0015.xml:4: error: attribute 'com.topjohnwu.magisk:alpha' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b0016.xml:4: error: attribute 'com.topjohnwu.magisk:alpha' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b0017.xml:4: error: attribute 'com.topjohnwu.magisk:alpha' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b0017.xml:5: error: attribute 'com.topjohnwu.magisk:alpha' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b0017.xml:6: error: attribute 'com.topjohnwu.magisk:alpha' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b009b.xml:5: error: attribute 'com.topjohnwu.magisk:state_dragged' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b009b.xml:6: error: attribute 'com.topjohnwu.magisk:state_dragged' not found.
    W: MIKE_Drive/Magisk/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b009c.xml:5: error: attribute 'com.topjohnwu.magisk:state_dragged' not found.
    W: MIKE_Drive/Magisk/res/layout/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f110003.xml:2: error: attribute 'com.topjohnwu.magisk:divider' not found.
    W: MIKE_Drive/Magisk/res/layout/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f110003.xml:2: error: attribute 'com.topjohnwu.magisk:dividerPadding' not found.
    W: MIKE_Drive/Magisk/res/layout/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f110005.xml:2: error: attribute 'com.topjohnwu.magisk:srcCompat' not found.
    W: MIKE_Drive/Magisk/res/values/public.xml:59: error: no definition for declared symbol 'com.topjohnwu.magisk:animator/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f070000'.
    W: MIKE_Drive/Magisk/res/values/public.xml:49: error: no definition for declared symbol 'com.topjohnwu.magisk:animator/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f070005'.
    W: MIKE_Drive/Magisk/res/values/public.xml:1016: error: no definition for declared symbol 'com.topjohnwu.magisk:color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b009b'.
    W: MIKE_Drive/Magisk/res/values/public.xml:1017: error: no definition for declared symbol 'com.topjohnwu.magisk:color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b009c'.
    W: MIKE_Drive/Magisk/res/values/public.xml:1039: error: no definition for declared symbol 'com.topjohnwu.magisk:color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b00b2'.
    W: MIKE_Drive/Magisk/res/values/public.xml:1040: error: no definition for declared symbol 'com.topjohnwu.magisk:color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0b00b3'.
    W: MIKE_Drive/Magisk/res/values/public.xml:2214: error: no definition for declared symbol 'com.topjohnwu.magisk:layout/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f110003'.
    brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/usr/bin/aapt2, link, -o, /tmp/APKTOOL7294337721314623591.tmp, --package-id, 127, --min-sdk-version, 17, --target-sdk-version, 28, --version-code, 264, --version-name, 7.4.1-7fa2625a, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, -0, arsc, -I, /root/.local/share/apktool/framework/1.apk, --manifest, MIKE_Drive/Magisk/AndroidManifest.xml, MIKE_Drive/Magisk/build/resources.zip]

    --------> I successfully decompiled the app but when I try to recompile it, it gives me an error like above. I think it's caused by the app's resources folder structure[By opening the original .apk file as an archive abd see.....]. It's different from other apps[Alk the .png images and *.xml files are placed in one folder named "res"].

-------->I tried without modifying anything on the decompiled app but it's the same.

--------> I tried the latest version of Apktool on other apps and it can successfully decompile and recompile thos apps after modification or without modification execpt Magisk Manager.

-------> I attached the logcat.txt file below

***TO DESCRIBE THE ERRORS SHORTLY.....**

State Dragged not found State liftable not found Alpha not found Divider not found DividePadding not found no definition for declared symbol

Steps to Reproduce

  1. apktool
  2. Decompile the app
  3. Trying to recompile the app[After Modification or without Modification]
  4. The error occurred

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)

APK

If this APK can be freely shared, please upload/attach a link to it. https://github.com/topjohnwu/magisk_files/blob/canary/app-release.apk

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?
  3. Are you using the latest apktool version? Yes
iBotPeaches commented 3 years ago

I replicate.

➜  2269 apktool b MagiskManager-v8.0.3 --use-aapt2
I: Using Apktool 2.4.2-f545c2-SNAPSHOT
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/animator/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f020005.xml:4: error: attribute state_dragged (aka com.topjohnwu.magisk:state_dragged) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/animator-v19/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f020005.xml:4: error: attribute state_dragged (aka com.topjohnwu.magisk:state_dragged) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/animator-v21/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f020000.xml:4: error: attribute state_liftable (aka com.topjohnwu.magisk:state_liftable) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/animator-v21/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f020000.xml:4: error: attribute state_lifted (aka com.topjohnwu.magisk:state_lifted) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f060002.xml:4: error: attribute alpha (aka com.topjohnwu.magisk:alpha) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f060003.xml:4: error: attribute alpha (aka com.topjohnwu.magisk:alpha) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f060013.xml:4: error: attribute alpha (aka com.topjohnwu.magisk:alpha) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f060014.xml:4: error: attribute alpha (aka com.topjohnwu.magisk:alpha) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f060015.xml:4: error: attribute alpha (aka com.topjohnwu.magisk:alpha) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f060016.xml:4: error: attribute alpha (aka com.topjohnwu.magisk:alpha) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f060017.xml:4: error: attribute alpha (aka com.topjohnwu.magisk:alpha) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f060018.xml:4: error: attribute alpha (aka com.topjohnwu.magisk:alpha) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f060018.xml:5: error: attribute alpha (aka com.topjohnwu.magisk:alpha) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f060018.xml:6: error: attribute alpha (aka com.topjohnwu.magisk:alpha) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0600aa.xml:5: error: attribute state_dragged (aka com.topjohnwu.magisk:state_dragged) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0600aa.xml:6: error: attribute state_dragged (aka com.topjohnwu.magisk:state_dragged) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/color/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0600ab.xml:5: error: attribute state_dragged (aka com.topjohnwu.magisk:state_dragged) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/drawable/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f08011f.xml:4: error: attribute state_indeterminate (aka com.topjohnwu.magisk:state_indeterminate) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/layout/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0c0003.xml:2: error: attribute divider (aka com.topjohnwu.magisk:divider) not found.
W: /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/res/layout/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f0c0003.xml:2: error: attribute dividerPadding (aka com.topjohnwu.magisk:dividerPadding) not found.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_88648246563240265114735839524630349416.tmp, link, -o, /tmp/APKTOOL6784681654068885152.tmp, --package-id, 127, --min-sdk-version, 17, --target-sdk-version, 28, --version-code, 314, --version-name, 8.0.3, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, -e, /tmp/APKTOOL5739971089443312134.tmp, -0, arsc, -I, /home/ibotpeaches/.local/share/apktool/framework/1.apk, --manifest, /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/AndroidManifest.xml, /home/ibotpeaches/Downloads/Apktool/2269/MagiskManager-v8.0.3/build/resources.zip]
➜  2269 

Marking as bug.