Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android LatinIME build

I want to make some changes to LatinIME. I got the code from git repository-

git clone https://android.googlesource.com/platform/packages/inputmethods/LatinIME

But I don't know how to build the apk file from the code. If anyone has build the LatinIME from the code, can you please share instructions.

Specifically I want to know how to build the dictionary tools (I guess I would need ndk), how to build the native code (again I guess it would required ndk) and finally how to build the java code by using the lib file from native code.

I tried creating Android app project in eclipse (using existing code option) by giving root directory as LatinIME/java I was able to compile but since it didn't have libjni_latinime.so, it crashed. I then got the .so file from emulator and put it in the libs/armeabi-v7a folder. Now I get this exception:

10-15 12:54:55.289: E/AndroidRuntime(32253): FATAL EXCEPTION: InitializeBinaryDictionary 
10-15 12:54:55.289: E/AndroidRuntime(32253): android.content.res.Resources$NotFoundException: File res/raw/main_en.dict from drawable resource ID #0x7f070003
like image 505
user2747986 Avatar asked Oct 15 '13 05:10

user2747986


3 Answers

I think I may have solved this...

Having encountered a similar problem in another project where resources were being unnecessarily compressed due to their file extension I renamed the dictionaries (.dict) to .jet - an extension excluded from compression. Voila, dictionaries are now working. Not sure how good of a resolution that is seeing as the dictionaries are now uncompressed but it's a step in the right direction at least?

like image 176
DarrynB Avatar answered Nov 15 '22 17:11

DarrynB


So far i have customised the LatinIME many times for different projects. I never faced this problem. But i never used eclipse to create apks. I downloaded whole AOSP code onto my machine and compiled the modified source with AOSP. And mm creates the apk file in out folder, and can be installed with adb install -r latinime.apk

Here is how to download AOSP :http://source.android.com/source/downloading.html And here is how to compile it initially : http://source.android.com/source/initializing.html and http://xda-university.com/as-a-developer/getting-started-building-android-from-source

And the LatinIME can be found in <android roo>/packages/inputmethods/LatinIME, Modify the code ther and cd to the same path and run mm (you need to do source build/envisetup.sh and lunch full-eng done in same terminal before doing mm)

like image 22
Charan Pai Avatar answered Nov 15 '22 17:11

Charan Pai


First some background. As also suggested by the other answer issue seems to be related of .dict files being compressed. For example you can see how official Android builds solve this in project's tests for LatinIME

# Do not compress dictionary files to mmap dict data runtime
LOCAL_AAPT_FLAGS += -0 .dict

A quick searching the web reveals that to day this kind of directive or instructing aapt from Eclipse isn't trivial. You would probably end up creating a build.xml in case you want to handle don't-compress-dicts case properly.

One nice suggestion is this answer/question on how to instruct aapt to not to compress certain files.

If you want to build this from official git link you provide, you'll end up building whole Android repo, which you can by following building-running instructions.

like image 5
auselen Avatar answered Nov 15 '22 18:11

auselen