[BUG] Rebuild fail: invalid resource name starting with dollar sign $avd_
Information
- Apktool Version: 3.0.3‑dirty
- Operating System: Termux (aarch64, Android)
- APK source: Self‑built debug APK from Android Studio, not OEM system ROM.
Describe the bug
After decoding a normal apk, rebuilding fails.
Apktool exported vector animation resource names that start with a dollar sign $, for example:
$avd_hide_password__0 , $avd_show_password__0
Android aapt2 compiler forbids resource names beginning with $.
This causes compilation error, decode‑build round‑trip broken.
No warning appears during decode phase.
Error message: rror: resource 'drawable/avd_hide_password__0'
Steps to reproduce
- Create an Android project with Material TextInputLayout password field
- Build debug apk in Android Studio
- Decode:
apktool d base.apk -o out - Rebuild:
apktool b out -o modified.apk
Additional context
Deleting those $avd_* entries inside public.xml can work as a temporary workaround.
error log
W: out/res/raw/mapstyle_night.json: note: compiling file. W: out/res/raw/mapstyle_simple.json: note: compiling file. W: out/res/raw/mobpush_sound.mp3: note: compiling file. W: out/res/raw/night_2026.json: note: compiling file. W: out/res/raw/zeus_keep_res_live.xml: note: compiling file. W: error: resource 'drawable/$avd_hide_password__0' has invalid entry name '$avd_hide_password__0. W: error: resource 'drawable/$avd_hide_password__1' has invalid entry name '$avd_hide_password__1. W: error: resource 'drawable/$avd_hide_password__2' has invalid entry name '$avd_hide_password__2. W: error: resource 'drawable/$avd_show_password__0' has invalid entry name '$avd_show_password__0. W: error: resource 'drawable/$avd_show_password__1' has invalid entry name '$avd_show_password__1. W: error: resource 'drawable/$avd_show_password__2' has invalid entry name '$avd_show_password__2. W: out/res/values/public.xml: error: file failed to compile. W: out/res/xml/csj_file_paths.xml: note: compiling XML. W: out/res/xml/file_paths.xml: note: compiling XML. W: out/res/xml/filepaths.xml: note: compiling XML. W: out/res/xml/gdt_file_path.xml: note: compiling XML. W: out/res/xml/standalone_badge.xml: note: compiling XML. W: out/res/xml/standalone_badge_gravity_bottom_end.xml: note: compiling XML. W: out/res/xml/standalone_badge_gravity_bottom_start.xml: note: compiling XML. W: out/res/xml/standalone_badge_gravity_top_start.xml: note: compiling XML. W: out/res/xml/standalone_badge_offset.xml: note: compiling XML. Exception in thread "main" brut.androlib.exceptions.AndrolibException: brut.common.BrutException: Execution failed (exit code = 1): [/data/data/com.termux/files/usr/bin/aapt2, compile, --dir, out/res, --legacy, -o, out/build/resources.zip, -v] at brut.androlib.res.AaptInvoker.invoke(SourceFile:91) at brut.androlib.ApkBuilder.buildResources(SourceFile:357) at brut.apktool.Main.main(SourceFile:92) Caused by: brut.common.BrutException: Execution failed (exit code = 1): [/data/data/com.termux/files/usr/bin/aapt2, compile, --dir, out/res, --legacy, -o, out/build/resources.zip, -v] at brut.util.OS.exec(SourceFile:147) at brut.androlib.res.AaptInvoker.invoke(SourceFile:88) ... 2 more /sdcard/openclaw $
We don't support aarch64. You're using your own aapt2 that lacks certain patches, like allowing the dollar sign in resource names.
As mentioned above. Sadly we don't support execution on Android. You are seeing why with this. Its hard to cross compile everything needed for the different arches and not something we have time for. Here is our aapt/2 code if you wish to compile something for your use-case - https://github.com/iBotPeaches/platform_frameworks_base