skip to Main Content

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:

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


  1. Chosen as BEST ANSWER

    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.


  2. 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:

    • Don’t use private resources. Embed them directly instead of referencing them, AOSP does not want you to reference things that are not on a forced contract.
    • Trick it by changing the resource entry @*android:color/Teal_800, this allows it to override the restriction
    • Help upgrade the internal aapt/aapt2 within Apktool and upstream a patch to resolve this more easily.

    context – Apktool Maintainer.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search