我正在创建一个Android应用程序。在应用程序中,我计划显示自己的键盘,可选择自动完成和自动更正(类似于带有一些自定义的默认键盘)。在互联网上搜索后,我得到了很多样本键盘应用。
但最后我才知道LatinIME是满足我要求的(可选择自动完成和自动更正)。
因此我从以下链接下载了LatinIME源代码。 https://android.googlesource.com/platform/packages/inputmethods/LatinIME/+/master/java
我可以构建源代码。但我无法在模拟器中安装它。因为默认的"键盘"已使用与com.android.inputmethod.latin
相同的软件包名称安装。
因此我将其包名更改为"com.android.inputmethod.latin.customize"
。
但现在我可以安装键盘应用程序,但我无法使用它。我遇到了以下问题。
1) The app installed in globally. But I want to install it only for my app. is it possible?
2) When I changed the package name I got the following issue.
04-22 18:26:59.431: E/AndroidRuntime(1206): FATAL EXCEPTION: main
04-22 18:26:59.431: E/AndroidRuntime(1206): java.lang.ExceptionInInitializerError
04-22 18:26:59.431: E/AndroidRuntime(1206): at java.lang.Class.newInstanceImpl(Native Method)
04-22 18:26:59.431: E/AndroidRuntime(1206): at java.lang.Class.newInstance(Class.java:1319)
04-22 18:26:59.431: E/AndroidRuntime(1206): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2233)
04-22 18:26:59.431: E/AndroidRuntime(1206): at android.app.ActivityThread.access$1600(ActivityThread.java:122)
04-22 18:26:59.431: E/AndroidRuntime(1206): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
04-22 18:26:59.431: E/AndroidRuntime(1206): at android.os.Handler.dispatchMessage(Handler.java:99)
04-22 18:26:59.431: E/AndroidRuntime(1206): at android.os.Looper.loop(Looper.java:137)
04-22 18:26:59.431: E/AndroidRuntime(1206): at android.app.ActivityThread.main(ActivityThread.java:4340)
04-22 18:26:59.431: E/AndroidRuntime(1206): at java.lang.reflect.Method.invokeNative(Native Method)
04-22 18:26:59.431: E/AndroidRuntime(1206): at java.lang.reflect.Method.invoke(Method.java:511)
04-22 18:26:59.431: E/AndroidRuntime(1206): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-22 18:26:59.431: E/AndroidRuntime(1206): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-22 18:26:59.431: E/AndroidRuntime(1206): at dalvik.system.NativeStart.main(Native Method)
04-22 18:26:59.431: E/AndroidRuntime(1206): Caused by: java.lang.ExceptionInInitializerError
04-22 18:26:59.431: E/AndroidRuntime(1206): at com.android.inputmethod.latin.customize.LatinIME.<clinit>(LatinIME.java:517)
04-22 18:26:59.431: E/AndroidRuntime(1206): ... 13 more
04-22 18:26:59.431: E/AndroidRuntime(1206): Caused by: java.lang.NoClassDefFoundError: com/android/inputmethod/latin/BinaryDictionary
04-22 18:26:59.431: E/AndroidRuntime(1206): at java.lang.Runtime.nativeLoad(Native Method)
04-22 18:26:59.431: E/AndroidRuntime(1206): at java.lang.Runtime.loadLibrary(Runtime.java:368)
04-22 18:26:59.431: E/AndroidRuntime(1206): at java.lang.System.loadLibrary(System.java:535)
04-22 18:26:59.431: E/AndroidRuntime(1206): at com.android.inputmethod.latin.utils.JniUtils.<clinit>(JniUtils.java:28)
04-22 18:26:59.431: E/AndroidRuntime(1206): ... 14 more
04-22 18:26:59.431: E/AndroidRuntime(1206): Caused by: java.lang.ClassNotFoundException: com.android.inputmethod.latin.BinaryDictionary
04-22 18:26:59.431: E/AndroidRuntime(1206): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
04-22 18:26:59.431: E/AndroidRuntime(1206): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
04-22 18:26:59.431: E/AndroidRuntime(1206): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
04-22 18:26:59.431: E/AndroidRuntime(1206): ... 18 more
我可以找到这个问题。在JniUtils中 - &gt;的System.loadLibrary(&#34; jni_latinime&#34); 但我找不到JNI。我应该在哪里更改&#34;包名称&#34;在&#34; jni_latinime&#34;?