1

I am trying to modify Android LatinIME (taken from AOSP).

I got the code from android_src/packages/inputmethod/LatinIME/java and pulled it into Eclipse using - new project from existing code. I also included missing dependency pacakage inputmethodcommon.

The code compiles and builds fine. But when I deploy it on emulator and open the keyboard, it crashes with the following exception-

FATAL EXCEPTION: InitializeBinaryDictionary
android.content.res.Resources$NotFoundException: File res/raw/main_en.dict from drawable resource ID #0x7f070003
at android.content.res.Resources.openRawResourceFd(Resources.java:1082)
at com.android.inputmethod.latin.BinaryDictionaryGetter.loadFallbackResource(BinaryDictionaryGetter.java:92)
at com.android.inputmethod.latin.BinaryDictionaryGetter.getDictionaryFiles(BinaryDictionaryGetter.java:328)
at com.android.inputmethod.latin.DictionaryFactory.createMainDictionaryFromManager(DictionaryFactory.java:55)
at com.android.inputmethod.latin.DictionaryFactory.createMainDictionaryFromManager(DictionaryFactory.java:83)
at com.android.inputmethod.latin.Suggest$1.run(Suggest.java:115)
Caused by: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
at android.content.res.AssetManager.openNonAssetFdNative(Native Method)
at android.content.res.AssetManager.openNonAssetFd(AssetManager.java:429)
at android.content.res.Resources.openRawResourceFd(Resources.java:1079)

Can anyone please help me fix this issue?

thanks!

user2747986
  • 211
  • 2
  • 5
  • same problem here. Did you solve it since then? – Yulong Jun 01 '14 at 23:38
  • Yes, it turns out directly building apk from eclipse won't work. The dictionaries were not properly added to the apk. I built the apk using command line with custom rule not to compress dict folder. – user2747986 Jun 02 '14 at 22:21
  • Is there any place I could look into for how to build apk using command line? – Yulong Jun 02 '14 at 22:34
  • I don't remember how I did it but I am sure there were plenty of links available online. Here is my build.xml and custom_rules.xml (included in build.xml)- http://pastebin.com/HSQDUJQg http://pastebin.com/3XgLE0mP – user2747986 Jun 02 '14 at 22:58
  • hey just curious, which version of Android you run the app on? mine is running ok on 4.4+ after building as you mentioned, but crashed on 4.3. seems 4.3 does not have some native libraries? – Yulong Jun 05 '14 at 19:33
  • Solved here: https://stackoverflow.com/questions/6186866/java-io-filenotfoundexception-this-file-can-not-be-opened-as-a-file-descriptor – Pnemonic Oct 03 '17 at 13:43

0 Answers0