I have created very simple android studio project and modified nothing. Apk is get successfully decompiled using command apktool d test1.apk
but when i do build the decompiled directory using command apktool b -o test_build.apk test1/
i’m getting error and no apk is generated.
Output of : apktool b -o test_build.apk test1/
┌──(root💀kattie)-[/home/kattie/android]
└─# apktool b -o test11.apk test1/
I: Using Apktool 2.4.1
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether resources has changed...
I: Building resources...
W: Failed to generate resource table for split ''
W: /home/kattie/android/test1/res/values-v31/colors.xml:3: error: Error: Resource is not public. (at 'm3_ref_palette_dynamic_neutral0' with value '@android:color/Teal_800').
W:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1):
[/tmp/brut_util_Jar_931359246141218477.tmp, p, --forced-package-id, 127, --min-sdk-version, 26, --target-sdk-version, 32, --version-code,
1, --version-name, 1.0, --no-version-vectors, -F, /tmp/APKTOOL10608228614004030548.tmp, -e, /tmp/APKTOOL8247866953395506188.tmp, -0, arsc,
-I, /root/.local/share/apktool/framework/1.apk, -S, /home/kattie/android/test1/res, -M, /home/kattie/android/test1/AndroidManifest.xml]
Tries:
-
I have tried to solve Failed to generate resource table for split ” but not worked.
-
I have tried to solve brut.androlib.AndrolibException: brut.common.BrutException: but not worked. (gives more errors)
My system details
System: linux
Java: openjdk version "11.0.11-ea" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11-ea+4-post-Debian-1) OpenJDK 64-Bit Server
VM (build 11.0.11-ea+4-post-Debian-1, mixed mode, sharing)Apktool: v2.4.1
Android studio: 2021.1.1, minSDK: 26, TargetSDK 32
2
Answers
I have solved this issue just by adding missing aapt.exe file in the apktool directory. But modified changes in the extracted apk director was unable to make signed apk properly, was giving so many errors.
So I used ApkEasyTool tool for signing, zipalign, compiling apk dir. This worked correctly.
An ongoing problem I’m debating on best path to solve. aapt2 versions are getting stricter to add more checks during compile time vs runtime. My gut is your building applications against lower versions than Apktool uses. You have a few options here:
@*android:color/Teal_800
, this allows it to override the restrictioncontext – Apktool Maintainer.