Android locale_config.xml Unbound Prefix Error

Viewed 680

I am currently pentesting an Android app. I decompiled the app without any issues and whenever I try to recompile it back, the apktool.jar throw Unbound Prefix Error from the locale_config.xml file. Checked the syntax and they're all okay. I don't have any clue on what's going on.

W: C:\platform-tools\patch-apk\swifty\base_SAP\res\xml\locales_config.xml:3: error: unbound prefix.
W: C:\platform-tools\patch-apk\swifty\base_SAP\res\xml\locales_config.xml: error: file failed to compile.
Failed!!!

Here's the content of the file:

<?xml version="1.0" encoding="utf-8"?>
<locale-config>
...
    <locale android:name="en-CA" />
    <locale android:name="en-GB" />
    <locale android:name="en-XC" />
    <locale android:name="en-IN" />
    <locale android:name="en-AU" />
    <locale android:name="zh-HK" />
...
</locale-config>
2 Answers

Update compileSdk and targetSdk version in the build.gradle file to version 33 or higher to fix the problem

android {
    compileSdk = 33
    defaultConfig {
        applicationId = "com.example.app"
        minSdk = 23
        targetSdk = 33
        ...
    }
    ...
}

For pentesting purposes, you might want to just get rid of localeConfig.

To do this with minimal changes:

  1. Comment out all the <locale android:name="..." /> lines in locales_config.xml.
  2. Remove android:localeConfig="@xml/locales_config" attribute of the <application> tag in AndroidManifest.xml.

That should do it.

Related