Apktool
Apktool copied to clipboard
[BUG] android:localeConfig in Manifest
Information
-
Apktool Version (
apktool -version
) -2.6.1 and older - Operating System (Mac, Linux, Windows) - Mac
- 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>
Since no apk. Is the extent of this test I add a new locales_config.xml
file to res/xml
with
<?xml version="1.0" encoding="utf-8"?>
<locale-config>
<locale android:name="ca" />
<locale android:name="da" />
<locale android:name="fa" />
....
</locale-config>
?
Hi,
i tested more apps, same error in :
https://play.google.com/store/apps/details?id=ak.alizandro.smartaudiobookplayer https://play.google.com/store/apps/details?id=com.instantbits.cast.webvideo https://play.google.com/store/apps/details?id=de.orrs.deliveries https://play.google.com/store/apps/details?id=com.coconuts.webnavigator
I just hit this issue with YouTube 17.05.38 https://www.apkmirror.com/apk/google-inc/youtube/youtube-17-05-38-release/youtube-17-05-38-android-apk-download/, all you have to do is decompile and recompile and it will refuse to build because of that file
in Manifest:
android:localeConfig="@xml/locales_config"
res/values/public.xml
res/xml/locales_config.xml
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/
The same problem is happening to me in some apks
I think I fixed this by adding ?
to the XML tags like so:
<?locale android:name="ca" /?>
<?locale android:name="da" /?>
<?locale android:name="fa" /?>
... etc
But now I get an output/AndroidManifest.xml:8: error: attribute android:localeConfig not found
error.
Sorry folks, still not replicating this.
➜ 2756 apktool d 2756.apk
I: Using Apktool 2.6.1 on 2756.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Baksmaling classes4.dex...
I: Baksmaling classes5.dex...
I: Baksmaling assets/audience_network.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
➜ 2756 apktool b 2756 --use-aapt2
I: Using Apktool 2.6.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 sources has changed...
I: Smaling smali_classes5 folder into classes5.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes4 folder into classes4.dex...
I: Checking whether sources has changed...
I: Smaling smali_assets folder into assets.dex...
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs... (/lib)
I: Copying libs... (/kotlin)
I: Copying libs... (/META-INF/services)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...
➜ 2756
I used this one - 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/
@iBotPeaches take the base.apk out of the 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/
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.
Okay thanks, now I replicate.
I: Building resources...
W: /home/ibotpeaches/Downloads/Apktool/2756/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): [/tmp/brut_util_Jar_27112266611582560847934334344813836868.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 30, --version-code, 4146, --version-name, 5.5.5b2, --no-version-vectors, -F, /tmp/APKTOOL2635192290980837099.tmp, -e, /tmp/APKTOOL4614977205943472114.tmp, -0, arsc, -I, /home/ibotpeaches/.local/share/apktool/framework/1.apk, -S, /home/ibotpeaches/Downloads/Apktool/2756/base/res, -M, /home/ibotpeaches/Downloads/Apktool/2756/base/AndroidManifest.xml]
➜ 2756 aapt d xmltree base.apk res/xml/locales_config.xml
E: locale-config (line=0)
E: locale (line=0)
Assigning bug.
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 😃
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 fileAndroidManifest.xml
and delete declarationandroid:localeConfig="@xml/locales_config"
Will be really happy if this issue solves in next update 😃
This is working.
update internal framework to API 33 (Tiramisu Privacy Preview) has solved this problem. No further action needed
Okay thanks @wortel-za - might see if I can add a test case for this. Otherwise closing.
@wortel-za can you please write some details about updating internal framework ?
@Gourov install lastest version and delete your old 1.apk framework before using
@wortel-za Could you provide more thorough instructions, please? I'm trying to use this with Objection but hitting this issue.
I encountered the same problem with telegram-sms apk. Using last version of Apktool v2.6.1 and JDK 1.8.0_202.
update internal framework to API 33 (Tiramisu Privacy Preview) has solved this problem. No further action needed
@wortel-za It is not clear how this can help.
@sunkrop the lastest build is apktool-2.6.2-63a8d09-SNAPSHOT-small.jar NOT 2.6.1 How to Build
Still have same problem on 2.7.0 when I re-compile following app
Can confirm that this is still an open issue on v2.7.0
For now , It can be fixed by following the steps
1-delete all locale from locales_config.xml file
2-build it as normal
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.
This is more difficult than I thought for Apktool to handle at the moment. During disassembly we use a pull-parser so we can only extract values and mutate them during extraction.
So to do a pure insertion of a missing key - we either have to treat it like we do for the AndroidManifest and trigger a full copy/modify, but that seems hacky. I need to figure out a good method for the ResFileDecoder to detect specify files that have modifications required post disassembly.
I've got no easy way to automate this at the time, so dropping into backlog. Please add the namespace manually if you encounter this issue.