Jump to content

[REQUEST] Help changing LatinIME.apk


Guest TheManicGibbon

Recommended Posts

Guest TheManicGibbon

I'm really struggling with APKTool (again) - I simply cannot get it to recompile after I make changes to LatinIME.

I'm wanting to change a line in Strings.xml to customise the smileys that appear when you long press the smileys button. The LatinIME.apk in question is attached and is from CM9 (Alfa 18 - a build for the Nexus S).

In Strings.xml I try to amend the line containing the smileys to

<string name="more_keys_for_smiley">":-D|:-D ,:'(|:'( ,:-\\\\\\\\|:-\\\\\\\\ ,O:-)|O:-) ,:-[|:-[ ,<3|<3 ,:-$|:-$ ,B-)|B-) ,:o|:o ,:-*|:-* ,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) "</string>

When I attempt to recompile this, I get loads of exceptions and all it builds is a classes.dex. Please help, it really is infuriating me because there's a problem with the build [i think] that means the smileys are displayed in reverse order, and I keep pushing the wrong ones!

A massive thanks to anyone that can help.

[sOLVED] To anyone who needs this, I was able to decompile and recompile the LatinIME apk using APKTool 1.4.2, and the latest aapt.exe by updating the Android SDK using SDK Manager.

Then, I replaced the existing string in Strings.xml with my version above, and recompiled.

Drag out resources.arsc to your desktop, and using 7-Zip, delete resources.arsc from the ORIGINAL apk and then add your new one. The reason for this is that, when compiled, all the values and xml folders are compiled into resources.arsc.

Hope this helps someone!

Link to comment
Share on other sites

Guest TheManicGibbon

where can I find this in the phone? I will see can I access it with an app on my phone

It's the keyboard app - it'll be in System so you'll need something like root explorer.

Link to comment
Share on other sites

Guest FelixL

I guess your version of apktool can't handle ICS. Afaik it needed changes for every Android version so far. Also, use one from the Blade, may be that you later get problems with the native libs the keyboard want's to use.

Link to comment
Share on other sites

Guest TheManicGibbon

If you want help you need to paste the error that you're getting. A bunch of exceptions is not helpful.

Indeed.

Right so I pull LatinIME.apk and framework-res.apk from the ROM zip and put them in /platform-tools/ in the SDK folder where I have aapt.exe, apktool.bat and apktool.jar.

I open a command prompt here and run apktool if framework-res.apk to install the framework.

I: Framework installed to: C:\Users\Jay\apktool\framework\1.apk

I then run apktool d LatinIME.apk, which decompiles the APK into a LatinIME folder.

I: Baksmaling...

I: Loading resource table...

I: Loaded.

I: Loading resource table from file: C:\Users\Jay\apktool\framework\1.apk

I: Loaded.

I: Decoding file-resources...

I: Decoding values*/* XMLs...

I: Done.

I: Copying assets and libs...

Even if I don't change anything, I can then try to recompile this by running apktool b LatinIME LatinIME-new.apk. Whether or not I make changes, I then get:

I: Checking whether sources has changed...

I: Smaling...

I: Checking whether resources has changed...

I: Building resources...

invalid resource directory name: K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res/layout-sw768dp

invalid resource directory name: K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res/values-sw600dp

invalid resource directory name: K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res/values-sw600dp-land

invalid resource directory name: K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res/values-sw768dp

invalid resource directory name: K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res/values-sw768dp-land

invalid resource directory name: K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res/xml-sw600dp

invalid resource directory name: K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res/xml-sw600dp-land

invalid resource directory name: K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res/xml-sw768dp

invalid resource directory name: K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res/xml-sw768dp-land

Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Users\Jay\AppData\Local\Temp\APKTOOL8073855659015209455.tmp, -I, C:\Us

ers\Jay\apktool\framework\1.apk, -S, K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res, -M, K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-wind

ows\platform-tools\LatinIME\AndroidManifest.xml]

at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)

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)

Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Users\Jay\AppData\Local\Temp\APKTOOL8073855659015209455.tmp, -I, C:\Users\Jay\apktool\framework\1.apk, -S, K:\Users\J

ay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\res, -M, K:\Users\Jay\Development\Android\AndroidSDK\android-sdk-windows\platform-tools\LatinIME\AndroidManifest.xml]

at brut.util.OS.exec(OS.java:83)

at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)

... 6 more

:(

UPDATE:

I beleive it is a problem with APKTool in decompiling ICS APKs, as seen here:

http://code.google.c...Owner%20Summary

UPDATE 2:

Trying to decompile, then recompile the LatinIME.apk from Gingerbread results in a massive list of exceptions far bigger than above. I can post that too if anyone thinks they'll be helpful.

Link to comment
Share on other sites

Guest brookergray

I'll see what results I get tomorrow. If you only need this on phones than you can remove the resource folders that it complains about (anything with sw600dp or sw768dp in it's name - those are for tablets).

It seems like it's an aapt problem.

Link to comment
Share on other sites

Guest TheManicGibbon

I'll see what results I get tomorrow. If you only need this on phones than you can remove the resource folders that it complains about (anything with sw600dp or sw768dp in it's name - those are for tablets).

It seems like it's an aapt problem.

Ah okay thanks, I'll try that :)

Tried deleting the folders for tablets, hundreds of errors. I can't work out if there is a problem with APKTool or if the problem lies with me.

Link to comment
Share on other sites

I tested using apktool 1.4.2 with latinime.apk from MMHMP and it recompiles fine, a few warnings from aapt about missing default translations, but seems ok.

Link to comment
Share on other sites

Guest KonstaT

Gingerbread LatinIME.apk should decompile/compile just fine. Even the latest apktool has some problems with ICS apks. First make sure that you have the latest apktool and make sure that you don't have another older copy of apktool somewhere on your path.

In general, sometimes there are apks that can't be decompiled/compiled because of broken resources and there isn't much you can do. Decompiling with 'apktool d --keep-broken-res file.apk' might help in some cases.

Solution to your problem is simple though. Build ICS from the source with your modifications. ;)

Edited by KonstaT
Link to comment
Share on other sites

Guest TheManicGibbon

I tested using apktool 1.4.2 with latinime.apk from MMHMP and it recompiles fine, a few warnings from aapt about missing default translations, but seems ok.

Yes, this works fine, I've just tried.

Gingerbread LatinIME.apk should decompile/compile just fine. Even the latest apktool has some problems with ICS apks. First make sure that you have the latest apktool and make sure that you don't have another older copy of apktool somewhere on your path.

In general, sometimes there are apks that can't be decompiled/compiled because of broken resources and there isn't much you can do. Decompiling with 'apktool d --keep-broken-res file.apk' might help in some cases.

Solution to your problem is simple though. Build ICS from the source with your modifications. ;)

I tried the LatinIME.apk pulled from a Nexus S, gives many errors. I've checked for other apktools, I only have 1 in my path and it's in platform tools.

Finally, the thought had crossed my mind but I'd really rather not. Is the whole thing not about a 6GB download? I don't have enough of my download limit left this month to do that sad.gif

Link to comment
Share on other sites

Guest TheManicGibbon

What's qaep? And is it possible to build it for Nexus S as well as the Blade, which is I think why you mention arm 6? Sorry for the noob question, I've never heard of any of that before and a Google hasn't really enlightened me any more :P

Link to comment
Share on other sites

Guest TheManicGibbon

Okay, I can't seem to change the apk I have, but I'm up for trying to build it from the source with my changes, however, I don't have enough download limit left with my ISP do download the whole 6GB ICS source code, so is it possible to download the source for JUST the LatinIME.apk from ICS and build that, with my changes?

I'm happy enough creating an Ubuntu VM or something for it to run in but it'd be good to have some pointers. Can anyone help me?

EDIT: Solved, see first post for a solution. PM me if you're trying to do this yourself and get stuck.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.