修复谷歌拼音输入法已停止运行
看日志,会有以下错误:
1 02-17 03:44:18.094 E/PinyinDecoderService( 4927): WARNING: Could not load jni_pinyinime natives 2 02-17 03:44:18.104 W/dalvikvm( 4927): No implementation found for native Lcom/android/inputmethod/pinyin/PinyinDecoderService;.nativeImOpenDecoderFd (Ljava/io/FileDescriptor;JJ[B)Z 3 02-17 03:44:18.104 D/AndroidRuntime( 4927): Shutting down VM 4 02-17 03:44:18.104 W/dalvikvm( 4927): threadid=1: thread exiting with uncaught exception (group=0x40a4c1f8) 5 02-17 03:44:18.109 E/AndroidRuntime( 4927): FATAL EXCEPTION: main 6 02-17 03:44:18.109 E/AndroidRuntime( 4927): java.lang.UnsatisfiedLinkError: nativeImOpenDecoderFd 7 02-17 03:44:18.109 E/AndroidRuntime( 4927): at com.android.inputmethod.pinyin.PinyinDecoderService.nativeImOpenDecoderFd(Native Method) 8 02-17 03:44:18.109 E/AndroidRuntime( 4927): at com.android.inputmethod.pinyin.PinyinDecoderService.initPinyinEngine(PinyinDecoderService.java:141) 9 02-17 03:44:18.109 E/AndroidRuntime( 4927): at com.android.inputmethod.pinyin.PinyinDecoderService.onCreate(PinyinDecoderService.java:162) 10 02-17 03:44:18.109 E/AndroidRuntime( 4927): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2253) 11 02-17 03:44:18.109 E/AndroidRuntime( 4927): at android.app.ActivityThread.access$1600(ActivityThread.java:123) 12 02-17 03:44:18.109 E/AndroidRuntime( 4927): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201) 13 02-17 03:44:18.109 E/AndroidRuntime( 4927): at android.os.Handler.dispatchMessage(Handler.java:99) 14 02-17 03:44:18.109 E/AndroidRuntime( 4927): at android.os.Looper.loop(Looper.java:137) 15 02-17 03:44:18.109 E/AndroidRuntime( 4927): at android.app.ActivityThread.main(ActivityThread.java:4424) 16 02-17 03:44:18.109 E/AndroidRuntime( 4927): at java.lang.reflect.Method.invokeNative(Native Method) 17 02-17 03:44:18.109 E/AndroidRuntime( 4927): at java.lang.reflect.Method.invoke(Method.java:511) 18 02-17 03:44:18.109 E/AndroidRuntime( 4927): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 19 02-17 03:44:18.109 E/AndroidRuntime( 4927): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 20 02-17 03:44:18.109 E/AndroidRuntime( 4927): at dalvik.system.NativeStart.main(Native Method)
从日志可以看出,显然是调用libjni_pinyinime.so出错,系统lib库中并没有此库,我们需要把libjni_pinyinime.so加入进去:
解决方法:
编辑 build/target/product/full_base.mk
在 PRODUCT_PACKAGES 中加上 libjni_pinyinime