[XPERIA X8 Android Development] pilu1978:
MiniCM10 Hacking tutorial part #1:

How to remove unwanted languages

to get more free space :)​

Preface:

1. This tutorial made for beginners/noobs. ;)

2. The main goal: make smaller rom to get enough free space on /system for .odex files and/or other stuff. :)

Required for this job:

xdaautool (link to the original thread: http://xdaforums.com/showthread.php?t=1053227 )

latest version of apktool (I used apktool 1.5.2, use search button ;))

a little piece of human brain... ;)

First step: install xdaautotool, and copy the latest apktool into the bin folder.

The method part 1: the decompiling...

1. Copy the framework-res.apk and all apk from the rom app folder into the _INPUT_APK folder inside xdaautotool

2. Select the apktool version from the dropbox (use the latest 1.5.2)

3. select the framework-res.apk and press the install framework-res button

4. Press the Decompile All button

5. Drink a coffee and wait... :D

The method part 2: removing the languages...

Some words about the locales in the android system. All language related stuff stored in the resource.arsc file. After the decompiling you get the separated language files in the /res/values-LANGUAGE_CODE-rREGION_CODE folders. For example: if you live in Canada and your used language is english, the needed language stored in values-en and values-en-rCA folders. If you also live in Canada but you use french language, your language files stored in values-fr and values-fr-rCA folders. :)

If you not know your language and region code, you can find the language codes here (you must see the ISO 639-2 code): http://www.loc.gov/standards/iso639-2/php/code_list.php and you can find your region code here: http://www.iso.org/iso/prods-servic...66-code-lists/country_names_and_code_elements

To make your work easier, here is the complete list of the folders what you can remove:

From the values and raw folders you can delete ALL FOLDER what contains these codes in the folder name:

-af, -af-rZA, -am, -am-rET, -ar, -ar-rEG, -bg, -bg-rBG, -ca, -ca-rES, -cs, -cs-rCZ, -da, -da-rDK, -de, -de-rAT, -de-rCH, -de-rDE, -de-rLI, -el, -el-rGR, -en-rAU, -en-rCA, -en-rGB, -en-rNZ, -en-rSG, -en-rUS, -es, -es-rES, -es-rUS, -fa, -fa-rIR, -fi, -fi-rFI, -fr, -fr-rBE, -fr-rCA, -fr-rCH, -fr-rFR, -hi, -hi-rIN, -hr, -hr-rHR, -hu, -hu-rHU, -in, -in-rID, -it, -it-rCH, -it-rIT, -iw, -iw-rIL, -ja, -ja-rJP, -ko, -ko-rKR, -lt, -lt-rLT, -lv, -lv-rLV, -ms, -ms-rMY, -nb, -nb-rNO, -nl, -nl-rBE, -nl-rNL, -pl, -pl-rPL, -pt, -pt-rBR, -pt-rPT, -rm, -rm-rCH, -ro, -ro-rRO, -ru, -ru-rRU, -sk, -sk-rSK, -sl, -sl-rSI, -sr, -sr-rRS, -sv, -sv-rSE, -sw, -sw-rTZ, -th, -th-rTH, -tl, -tl-rPH, -tr, -tr-rTR, -ug, -ug-rCN, -uk, -uk-rUA, -vi, -vi-rVN, -zh-rCN, -zh-rTW, -zu, -zu-rZA

Note #1: another useless stuffs stored in the values-mcc folders, if you know your mobile country code (MCC) and mobile network code (MNC) you can remove all unwanted folder. :)

Note #2: instead of removing all folders manually, make a simple script what remove all listed folders (except the needed folders of your language) :)

The method part 3: the recompiling...

1. Press the Recompile All button :)

2. Drink a coffee and wait... ;)

The method part 4: correct the errors...

After the recompiling, you need to check the whole log to search errors (don't worry, you will find only few error message)

A typical error in the log window when you compiling the Contacts.apk:

...\Contacts\res\values\public.xml:363: error: Public symbol array/entries_vm_button declared here is not defined.
...\Contacts\res\values\public.xml:364: error: Public symbol array/view_contact_pic_sizes declared here is not defined.
...\Contacts\res\values\public.xml:365: error: Public symbol array/view_data_font_sizes declared here is not defined.
...\Contacts\res\values\public.xml:1429: error: Public symbol plurals/groupDescrip declared here is not defined.
...\Contacts\res\values\public.xml:1430: error: Public symbol plurals/groupDescripPhones declared here is not defined.

To solve it you need to edit the public.xml in Contacts\res\values. Just remove the listed lines and recompile the app again. :D

The method part 5: rebuild the rom...

Okay, all app recompiled, but how to use it??? :D

All compiled app stay in the dist folder inside the decompiled app folder (example: the settings.apk without the unwanted languages stay in _INPUT_APK\Settings\dist folder.

TO DO: just grab the resource.arsc file from the recompiled app, and copy it into the _INPUT_APK\settings.apk file. :)

You can see the difference, the original resource.arsc file is 6.193.940 byte, the new one is around 500.000 :D:D:D The original setings.apk is more than 8MB, the new one is less than 3!!! ;)

Note: You can ask: Why need to copy the resources.arsc from the new apk into the old, instead of using the new compiled app? :confused:

The answer is simple: all apk need to sign after the compiling, and different apps in /system/app need different keys to sign (platform, shared or media, some work with testkey), more easy way if you put back the new resource.arsc into the old, signed app. :)

After replacing all resource.arsc file, just copy back the apks into the .zip file of the rom, flash it, and enjoy... ;)

Final words: if you remove all unwanted language from the rom, you gain approx 23MB of free space. :)

But not need to remove the languages from all app, with small apps (what is only a few kilobytes) not need to do this. Check the resource.arsc file inside the app, if this is small (for example: in the QuickSearchBox.apk the resource.arsc is only 96.960 byte) not need to remove the language files because you can't gain valuable free space. :(

You can get significant size differences with these apps: framework-res, settings, contacts, phone, and a few others. :)

Okay, this "tutorial" is finished, next time I will talk about how to remove redundant resources... ;)