Apktool
Apktool copied to clipboard
[BUG] Can't decompile and build back
Information
- Apktool Version (
apktool -version) - 2.6.0 - Operating System (Mac, Linux, Windows) - Linux
- APK From? (Playstore, ROM, Other) - Apkmirror
Stacktrace/Logcat
I: Using Apktool 2.6.0
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 resources has changed...
I: Building resources...
W: /home/ven/Downloads/./decode/res/values/strings.xml:756: error: Error parsing XML: not well-formed (invalid token)
W:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_139923756295934419981872978804750466086.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 30, --version-code, 4007588, --version-name, 4.33.0+7588-google, --no-version-vectors, -F, /tmp/APKTOOL8692265673826763217.tmp, -e, /tmp/APKTOOL6150157919371772061.tmp, -0, arsc, -I, frameworks/1.apk, -S, /home/ven/Downloads/./decode/res, -M, /home/ven/Downloads/./decode/AndroidManifest.xml]
This is from strings.xml:
...
<string name="APKTOOL_DUMMYVAL_0x7f130425">Please connect your mobile device to your Home wifi network to resume service or if you have moved to a new zip code, please update this via your account. Check this page for more info <a href="https://help.hulu.com/s/article/home-network?language=en_US&" utm_campaign="reply&" utm_medium="questions&" utm_source="community">help.hulu.com</a></string>
...
I figured this is because of HTML tags so I removed them and got another error:
I: Using Apktool 2.6.0
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
W: /home/ven/Downloads/./decode/AndroidManifest.xml:6: Tag <provider> missing required attribute name.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_109421762973788403236676800601841373402.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 30, --version-code, 4007588, --version-name, 4.33.0+7588-google, --no-version-vectors, -F, /tmp/APKTOOL4993021422586771786.tmp, -e, /tmp/APKTOOL822963098399151905.tmp, -0, arsc, -I, frameworks/1.apk, -S, /home/ven/Downloads/./decode/res, -M, /home/ven/Downloads/./decode/AndroidManifest.xml]
From manifest:
<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:compileSdkVersion="30" android:compileSdkVersionCodename="11" package="com.hulu.plus" platformBuildVersionCode="30" platformBuildVersionName="11">
<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService"/>
</intent>
<provider android:authorities="com.google.android.mediahome.video"/>
</queries>
...
I also tried using aapt2:
I: Using Apktool 2.6.0
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
W: /home/ven/Downloads/./decode/res/values-anydpi-v26/mipmaps.xml:3: error: invalid value for type 'mipmap'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-anydpi-v26/mipmaps.xml:4: error: invalid value for type 'mipmap'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-anydpi-v26/mipmaps.xml: error: file failed to compile.
W: /home/ven/Downloads/./decode/res/values-hdpi/mipmaps.xml:3: error: invalid value for type 'mipmap'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-hdpi/mipmaps.xml:4: error: invalid value for type 'mipmap'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-hdpi/mipmaps.xml: error: file failed to compile.
W: /home/ven/Downloads/./decode/res/values-land/layouts.xml:3: error: invalid value for type 'layout'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-land/layouts.xml:4: error: invalid value for type 'layout'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-land/layouts.xml:5: error: invalid value for type 'layout'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-land/layouts.xml:7: error: invalid value for type 'layout'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-land/layouts.xml:8: error: invalid value for type 'layout'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-land/layouts.xml:9: error: invalid value for type 'layout'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-land/layouts.xml:10: error: invalid value for type 'layout'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-land/layouts.xml:11: error: invalid value for type 'layout'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-land/layouts.xml: error: file failed to compile.
W: /home/ven/Downloads/./decode/res/values-land/xmls.xml:3: error: invalid value for type 'xml'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-land/xmls.xml: error: file failed to compile.
W: /home/ven/Downloads/./decode/res/values-ldrtl/layouts.xml:3: error: invalid value for type 'layout'. Expected a reference.
W: /home/ven/Downloads/./decode/res/values-ldrtl/layouts.xml: error: file failed to compile.
W: /home/ven/Downloads/./decode/res/values-mdpi/mipmaps.xml:3: error: invalid value for type 'mipmap'. Expected a reference.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_156866912678459221862420486394210351856.tmp, compile, --dir, /home/ven/Downloads/./decode/res, --legacy, -o, /home/ven/Downloads/./decode/build/resources.zip]
This is from mipmaps.xml for first error:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="mipmap" name="ic_launcher">dA.xml</item>
<item type="mipmap" name="ic_launcher_round">dj.xml</item>
</resources>
Steps to Reproduce
java -jar apktool_2.6.0.jar decode -o decode/ -p frameworks/ com.hulu.plus_4.33.0_7588-google-4007588_minAPI21\(arm64-v8a\,armeabi-v7a\,x86\,x86_64\)\(nodpi\)_apkmirror.com.apkjava -jar apktool_2.6.0.jar build -o ./recompiled.apk -p frameworks/ ./decode/
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
https://www.apkmirror.com/apk/hulu/hulu-hulu/hulu-hulu-4-33-07588-google-release/
Questions to ask before submission
- Have you tried
apktool d,apktool bwithout changing anything? Yes this is what this error is for - If you are trying to install a modified apk, did you resign it? No
- Are you using the latest apktool version? Yes
Remove layouts.xml, mipmaps.xml from values dir. It not resources from values dir. Such files should have been ignored, but since there is no path in dA.xml, they were written by mistake. In general, first deobfuscate resources (like MT Manager or ResSimplify), because this is most likely not the only error that will.
Remove layouts.xml, mipmaps.xml from values dir. It not resources from values dir. Such files should have been ignored, but since there is no path in
dA.xml, they were written by mistake. In general, first deobfuscate resources (like MT Manager or ResSimplify), because this is most likely not the only error that will.
I tried removing those files and finally managed to build the apk but I couldn't launch the app (it crashed right away)
it crashed right away
It is normal. Maybe app contains signatures check... It not related to apktool
Same problem here. apktool d tiktok.apk apktool b tiktok
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_88056147111159038378597581799857114240.tmp, p, --debug-mode, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 28, --version-code, 2021507460, --version-name, 15.7.46, --no-version-vectors, -F, /tmp/APKTOOL7151015429767387527.tmp, -e, /tmp/APKTOOL3171821722963975671.tmp, -0, arsc, -I, ...]]
For tiktok or any splitted apk i recomend [redacted]
it crashed right away
It is normal. Maybe app contains signatures check... It not related to apktool
Tried deleting all the files that gave errors, almost ended up deleting the whole values directory. This does not solve anything, however using aapt gives only the error with AndroidManifest file as mentioned above, which is again a dead end. Apk file: https://m.apkpure.com/hulu-watch-tv-shows-movies/com.hulu.plus/download?from=details