Apktool: [BUG] android:localeConfig in Manifest

Information

  1. Apktool Version (apktool -version) -2.6.1 and older
  2. Operating System (Mac, Linux, Windows) - Mac
  3. APK From? (Playstore, ROM, Other) - Playstore

Stacktrace/Logcat

Include stacktrace here
W: /xxx/BookmarkFolder_v5.0.5_129/res/xml/locales_config.xml:3: error: unbound prefix.
W: /xxx/BookmarkFolder_v5.0.5_129/res/xml/locales_config.xml: error: file failed to compile.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/sm/q39kpprx0175hypt_zz76qb00000gn/T/brut_util_Jar_70428711240655456118660710679018899199.tmp, compile, --dir, /xxx/BookmarkFolder_v5.0.5_129/res, --legacy, -o, /xxx/BookmarkFolder_v5.0.5_129/build/resources.zip]

### Steps to Reproduce
1. `apktool  -advance   b   -d  -p /Applications/Tools/TelefonApps/MyApkTool.app/Contents/Resources/framework/ --use-aapt2 '/xxx/BookmarkFolder_v5.0.5_129/'

### 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
If this APK can be freely shared, please upload/attach a link to it.
BookmarkFolder_v5.0.5_129.apk

### Questions to ask before submission
1. Have you tried `apktool d`, `apktool b` without changing anything? yes
2. If you are trying to install a modified apk, did you resign it? not possible
3. Are you using the latest apktool version? yes tried also older versions

Error file : /xxx/BookmarkFolder_v5.0.5_129/res/xml/locales_config.xml
W: /xxx/BookmarkFolder_v5.0.5_129/res/xml/locales_config.xml:3: error: unbound prefix.
<?xml version="1.0" encoding="utf-8"?>
<locale-config>
    <locale android:name="ca" />
    <locale android:name="da" />
    <locale android:name="fa" />
   ....
</locale-config>

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 6
  • Comments: 24 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I have encounter a same problem with this app … https://play.google.com/store/apps/details?id=org.hostedgames.zexsh

Its a split and problem with base.apk …


I: Using Apktool 2.6.1
I: Smaling smali folder into classes.dex...
I: Building resources...
W: D:\InstallationFiles\ApkEasyTool_v1.59.2\1-Decompiled APKs\base\res\xml\locales_config.xml:3: error: Error parsing XML: unbound prefix
W: 
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\Gourov\AppData\Local\Temp\brut_util_Jar_159871407586383149737413562893265274635.tmp, p, --forced-package-id, 127, --min-sdk-version, 19, --target-sdk-version, 30, --version-code, 26, --version-name, 3.0.2, --no-version-vectors, -F, C:\Users\Gourov\AppData\Local\Temp\APKTOOL8716755988559573126.tmp, -e, C:\Users\Gourov\AppData\Local\Temp\APKTOOL1637710390933913995.tmp, -0, arsc, -I, C:\Users\Gourov\AppData\Local\apktool\framework\1.apk, -S, D:\InstallationFiles\ApkEasyTool_v1.59.2\1-Decompiled APKs\base\res, -M, D:\InstallationFiles\ApkEasyTool_v1.59.2\1-Decompiled APKs\base\AndroidManifest.xml]

For now , It can be fixed by following the steps below… delete file \res\xml\locales_config.xml open file \res\values\public.xml and delete line <public type="xml" name="locales_config" id="0x7f110003" /> open file AndroidManifest.xml and delete declaration android:localeConfig="@xml/locales_config"

Will be really happy if this issue solves in next update 😃

update internal framework to API 33 (Tiramisu Privacy Preview) has solved this problem. No further action needed

@sunkrop the lastest build is apktool-2.6.2-63a8d09-SNAPSHOT-small.jar NOT 2.6.1 How to Build

Sorry for delay on this. I took a look.

The original error is this:

W: /media/ibotpeaches/AOSP/Apktool/2756/base/res/xml/locales_config.xml:3: error: unbound prefix.
W: /media/ibotpeaches/AOSP/Apktool/2756/base/res/xml/locales_config.xml: error: file failed to compile.

Which is basically because there are no namespaces, so it can’t properly resolve these properties. Oddly though this namespace isn’t found so Apktool isn’t doing anything wrong.

➜  2756 aapt2 d xmltree base.apk --file res/xml/locales_config.xml
E: locale-config (line=0)
    E: locale (line=0)
      A: android:name="ja" (Raw: "ja")
    E: locale (line=0)

So if we add the namespace

<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
    <locale android:name="ja" />
    <locale android:name="bg" />
    <locale android:name="nl" />
    <locale android:name="es" />

The build works.

➜  2756 apktool b base --use-aapt2                                              
I: Using Apktool v2.8.1-41-0e226928-SNAPSHOT
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs... (/kotlin)
I: Copying libs... (/META-INF/services)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk into: base/dist/base.apk
➜  2756

So I think I’ll patch Apktool to explicitly look for the locale-config XML tag and add the namespace during disassembly. My guess is this is a bug in Android in generating this file, as if you manually create it per: https://developer.android.com/guide/topics/resources/app-languages you add the namespace.

in Manifest:

android:localeConfig=“@xml/locales_config

res/values/public.xml

<public type="xml" name="locales_config" id="0x7f16000b" />

res/xml/locales_config.xml

<?xml version="1.0" encoding="utf-8"?> <locale-config> <locale android:name="ja" /> <locale android:name="bg" /> .... </locale-config>

the locales_config.xml file is used exclusively in the base.apk of bundles (apkmirror .apkm), the apk as a single apk does not contain this file. the specification android:localeConfig=“@xml/locales_config” in the manifest is also only in the base.apk of a bundle.

Example: Web Video Cast
Apk as Bundle:

https://www.apkmirror.com/apk/instantbits-inc/web-video-cast-browser-to-tv-chromecastdlna/web-video-cast-browser-to-tv-chromecastdlna-5-5-5b2-release/web-video-cast-browser-to-tv-5-5-5b2-android-apk-download/

Apk as Single File:

https://www.apkmirror.com/apk/instantbits-inc/web-video-cast-browser-to-tv-chromecastdlna/web-video-cast-browser-to-tv-chromecastdlna-5-5-5b2-release/web-video-cast-browser-to-tv-5-5-5b2-2-android-apk-download/