Recompiling Framework-miui-res.apk


helion

Members
Nov 29, 2012
5
21
Hi, I have a HTC Pyramid, I'm using a JB ROM with MIUI 2.11.23 and I'm trying to translate it.
I've added the valuesxx to all sys apks, but the desired lang does not appear in the Language settings.
So, I'm trying to recompile Framework-miui-res
I've done that using aapt and ApkTool.jar from here:

E:\MIUI\manual>ls
aapt.exe com.htc.resources.apk framework-res.apk
apktool.jar framework-miui-res.apk

E:\MIUI\manual>E:\MIUI\manual>java -jar apktool.jar if framework-res.apk
I: Framework installed to: C:\Users\Christian\apktool\framework\1.apk

E:\MIUI\manual>java -jar apktool.jar if framework-miui-res.apk
I: Framework installed to: C:\Users\Christian\apktool\framework\6.apk

E:\MIUI\manual>java -jar apktool.jar if com.htc.resources.apk
I: Framework installed to: C:\Users\Christian\apktool\framework\2.apk

So in apktool/framework I have now

804K Nov 29 18:47 1.apk
1.6M Nov 29 18:47 2.apk
252K Nov 29 18:47 6.apk

Well, I decompile framework-miui-res:
E:\MIUI\manual>java -jar apktool.jar d framework-miui-res.apk
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Christian\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...
And edit res/values/arrays.xml and add a ONLY line:


<string-array name="supported_locale">
<item>zh_CN</item>
<item>zh_TW</item>
<item>en_US</item>
<item>ru_RU</item>
<item>uk_UA</item>
<item>es_ES</item>

</string-array>

Saved the file and recompile framework-miui-res
E:\MIUI\manual>java -jar apktool.jar b framework-miui-res modded.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'christmas_dad' has no default translation in E:\MIUI\manu
al\framework-miui-res\res; found: en_GB en_US es_ES
aapt: warning: string 'description_modifiedtime' has no default translation in E
:\MIUI\manual\framework-miui-res\res; found: en_GB en_US es_ES
aapt: warning: string 'perm_use_pin_security' has no default translation in E:\M
IUI\manual\framework-miui-res\res; found: en_GB en_US es_ES
I: Building apk file...

I'm scared with that "Could not find sources", What's missing here?
If I push the file to the phone, clear chache and dalvik, it bootlops
Regards and thanks all
 

ingbrzy

Xiaomi.eu ROM leader
Staff member
Feb 11, 2012
10,574
322
apktool.yml:

version: 1.4.3
apkFileName: framework-miui-res.apk
isFrameworkApk: true
usesFramework:
ids:
- 1
- 2
- 3
- 4
- 5
 

helion

Members
Nov 29, 2012
5
21
That's mi apktool.yml now

version: 1.5.0.5a056e3
apkFileName: framework-miui-res.apk
isFrameworkApk: true
usesFramework:
ids:
- 1
- 2
- 3
- 4
- 5
sdkInfo:
minSdkVersion: '16'
targetSdkVersion: '16'
Output of compilation

E:\MIUI\manual>java -jar apktool.jar b framework-miui-res modded.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building apk file...

But the modded.apk still smaller than original

1.7M Feb 29 2008 framework-miui-res.apk
5.7M Feb 29 2008 framework-res.apk
1.5M Nov 29 19:20 modded.apk
I'm going to download that apktool version
 

helion

Members
Nov 29, 2012
5
21
With Apktool 1.4.3 gives me that:
E:\MIUI\manual>java -jar apktool.jar b framework-miui-res mod.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
Exception in thread "main" brut.androlib.err.CantFindFrameworkResException
at brut.androlib.res.AndrolibResources.getFrameworkApk(AndrolibResources
.java:366)
at brut.androlib.Androlib.parseUsesFramework(Androlib.java:400)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
at brut.androlib.Androlib.buildResources(Androlib.java:248)
at brut.androlib.Androlib.build(Androlib.java:171)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:182)
at brut.apktool.Main.main(Main.java:67)
 

helion

Members
Nov 29, 2012
5
21
Because it couldn't find those frameworks. You have to install them.
I have that installed, I need any other?
E:\MIUI\manual>E:\MIUI\manual>java -jar apktool.jar if framework-res.apk
I: Framework installed to: C:\Users\Christian\apktool\framework\1.apk

E:\MIUI\manual>java -jar apktool.jar if framework-miui-res.apk
I: Framework installed to: C:\Users\Christian\apktool\framework\6.apk

E:\MIUI\manual>java -jar apktool.jar if com.htc.resources.apk
I: Framework installed to: C:\Users\Christian\apktool\framework\2.apk
 

helion

Members
Nov 29, 2012
5
21
Oh, I've noticed that, where did I get that? There aren't more .apk in /system/framework