iBotPeaches / Apktool

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

[BUG] Unable to recompile decompiled apk #3637

Open Were-Logan-0110 opened 1 month ago

Were-Logan-0110 commented 1 month ago

Information

  1. Apktool Version (2.9.3) -
  2. Operating System (Windows 10) -
  3. APK From? Uptodown -
  4. Java Version (22.0.1) -
Include stacktrace here

Steps to Reproduce

  1. apktool d facebook-369-0-0-18-103.apk Output
    I: Using Apktool 2.9.3 on facebook-369-0-0-18-103.apk
    I: Loading resource table...
    W: End of chunk hit. Skipping remaining entries (11027) in type: id
    I: Decoding file-resources...
    I: Loading resource table from file: C:\Users\ahmed\AppData\Local\apktool\framework\1.apk
    I: Decoding values */* XMLs...
    I: Decoding AndroidManifest.xml with resources...
    I: Regular manifest package...
    I: Baksmaling classes.dex...
    I: Copying assets and libs...
    I: Copying unknown files...
    I: Copying original files...
    Press any key to continue . . .

2- apktool b facebook-369-0-0-18-103 Output

I: Using Apktool 2.9.3
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\$avd_hide_password__0.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\$avd_hide_password__1.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\$avd_hide_password__2.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\$avd_show_password__0.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\$avd_show_password__1.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\$avd_show_password__2.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_action_bar_item_background_material.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_btn_borderless_material.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_btn_check_material.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_btn_check_material_anim.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_btn_colored_material.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_btn_default_mtrl_shape.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_btn_radio_material.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_btn_radio_material_anim.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_cab_background_internal_bg.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_cab_background_top_material.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_control_background_material.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_edit_text_material.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_ic_ab_back_material.xml'.
W: error: invalid file path 'E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res\drawable2\abc_ic_arrow_drop_right_black_24dp.xml'.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\ahmed\AppData\Local\Temp\brut_util_Jar_1012654204347618755261853745814405872.tmp, compile, --dir, E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\res, --legacy, -o, E:\me\projects\changeFacebookInfo\dist\Change Facebook Data N\t\facebook-369-0-0-18-103\build\resources.zip]
Press any key to continue . . .

APK

If this APK can be freely shared, please upload/attach a link to it. Facebook version 369.0.0.18.103 https://facebook.ar.uptodown.com/android/download/67070568

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

One last thing im not really interested in editing the apk much all i want is to specify the networkSecurityConfig to accept system certs

iBotPeaches commented 1 month ago

I replicate this.

It appears we have drawable2 - a relic of duplicate res types Facebook introduces. We fixed this for styles2, styles3 etc and I thought that would work as well for drawables.

I'll need to be investigated.

Were-Logan-0110 commented 1 month ago

I replicate this.

It appears we have drawable2 - a relic of duplicate res types Facebook introduces. We fixed this for styles2, styles3 etc and I thought that would work as well for drawables.

I'll need to be investigated.

any updates?

comk commented 2 days ago

I have the same problem, just decompile and then recompile:

decompile

I: Using Apktool 2.9.3 on test.apk
I: Loading resource table...
I: Decoding file-resources...
I: Loading resource table from file: C:\Users\86156\AppData\Local\apktool\framework\1.apk
I: Decoding values */* XMLs...
I: Decoding AndroidManifest.xml with resources...
I: Regular manifest package...
I: Baksmaling classes.dex...
I: Baksmaling classes3.dex...
I: Baksmaling classes4.dex...
I: Baksmaling classes7.dex...
I: Baksmaling classes5.dex...
I: Baksmaling classes6.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes8.dex...
I: Baksmaling classes9.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory

recompile

I: Using Apktool 2.9.3
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes4 folder into classes4.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes5 folder into classes5.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes6 folder into classes6.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes7 folder into classes7.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes8 folder into classes8.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes9 folder into classes9.dex...
I: Checking whether resources has changed...
I: Building resources...
W: C:\Users\86156\AndroidStudioProjects\...\debug\test\AndroidManifest.xml:1: error: attribute android:compileSdkVersion not found.
W: C:\Users\86156\AndroidStudioProjects\...\debug\test\AndroidManifest.xml:1: error: attribute android:compileSdkVersionCodename not found.
W: C:\Users\86156\AndroidStudioProjects\...\debug\test\AndroidManifest.xml:24: error: attribute android:appComponentFactory not found.
W: C:\Users\86156\AndroidStudioProjects\...\debug\test\AndroidManifest.xml:24: error: attribute android:dataExtractionRules not found.
W: error: failed processing manifest.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\86156\AppData\Local\Temp\brut_util_Jar_16882859377993602143421510549278852168.tmp, link, -o, C:\Users\86156\AppData\Local\Temp\APKTOOL6621035917404623942.tmp, --package-id, 127, --min-sdk-version, 28, --target-sdk-version, 28, --version-code, 1, --version-name, 1.0, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, --no-compile-sdk-metadata, --warn-manifest-validation, -e, C:\Users\86156\AppData\Local\Temp\APKTOOL967740312697695509.tmp, -0, arsc, -I, C:\Users\86156\AppData\Local\apktool\framework\1.apk, --manifest, C:\Users\86156\AndroidStudioProject\...\debug\test\AndroidManifest.xml, C:\Users\86156\AndroidStudioProjects\...\debug\test\build\resources.zip]

hope for update