How to fix apktool compiling errors


Well, there are many reasons why but I will show you most common errors. Note, i'm talking about general apk modding, not system apk/framework modding

assets.dex issue (Class xxx has already been interned)
By default, apktool try to decompile dex stored on assets folder which would decompile to smali_assets on a root directory of decompiled apk, and compiled to assets.dex upon compiling

This causing issues on some games "Class xxx has already been interned" and "Not a valid dex magic value" if the dex was encrypted

Solution:
To fix the problem, decompile APK again with the flag [code]--only-main-classes[/code] to only decompile on main classes in root (classes[0-9].dex) then you can compile without any problem

Note: Only for apktool 2.4.1 and up

You can try to delete .dex from assets folder or smali_assets/assets.dex but it may cause problems

If you are using APK Easy Tool 1.57 beta, you can enable the option "Only disassemble the main dex classes" under Options -> Apktool. Again, only for apktool 2.4.1 and up



Resource error (brut.common.BrutException: could not exec (exit code = 1)
This issue is very hard to understand but I know it is resources related

The following errors may cause the brut.common.BrutException error (correct me if i'm wrong)
[CODE]- Error retrieving parent for item: No resource found that matches the given name
- error: Public symbol xxx declared here is not defined.[/CODE]

Solution:
You can try using other apktool.jar versions and clear the framework using [CODE]empty-framework-dir --force[/CODE]. Always clear the framework after you switch them
If you don't modify AndroidManifest.xml and other xml files, you can decompile APK without resources

Resource error (APKTOOL_DUMMY)
If you get APKTOOL_DUMMY that's generally because apktool can't decode some of the information in the original APK and creates a 'dummy' value instead. Because there's no things called APKTOOL_DUMMY in public.xml, the APK can't be recompiled. It's likely because you try to compile splitted APK with some missing infomation

Solution:
Merge split APKs manually
[URL unfurl="true"]https://platinmods.com/threads/how-to-turn-a-split-apk-into-a-normal-non-split-apk.76683/[/URL]

Or use the SAP (Split APK Packer) tool
[URL unfurl="true"]https://platinmods.com/threads/sap-split-apks-packer-by-kirlif-windows-linux-merge-split-apks-into-single-apk.101798/[/URL]

Other issues
- APK is protected, encrypted or obfuscated. Reversing of such files is beyond the scope, so find out yourself
- Invalid syntax in smali and xml. Read the log carefully and see what it says. You may have done something wrong

You can search for useful infomation on the following sites.
Report any issues to them if you feel like to

Smali/baksmali: JesusFreke/smali


Kommentarer