Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
226 views
in Technique[技术] by (71.8m points)

android - Cannot Resolve Corresponding JNI Function Java_com_android_inputmethod_keyboard_ProximityInfo_setProximityInfoNative

I'm building LatinIME source code provided by google-source in android-studio but i got a bug in ProximityInfo.java line 89 which show a dialog like this and i have added a jni_latinime.so in src/main/jniLibs like this. But the bug is still not fixed.What mistake i did and what should i have to do now?

Error

droid.inputmethod.latin E/JniUtils: Could not load native library jni_latinime
   java.lang.UnsatisfiedLinkError: unknown failure
       at java.lang.Runtime.loadLibrary(Runtime.java:370)
       at java.lang.System.loadLibrary(System.java:535)
       at com.android.inputmethod.latin.utils.JniUtils.<clinit>(JniUtils.java:28)
       at com.android.inputmethod.latin.LatinIME.<clinit>(LatinIME.java:546)
       at java.lang.Class.newInstanceImpl(Native Method)
       at java.lang.Class.newInstance(Class.java:1319)
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:2406)
       at android.app.ActivityThread.access$1700(ActivityThread.java:140)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4944)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
       at dalvik.system.NativeStart.main(Native Method)
05-28 21:58:48.483 1642-1957/system_process E/InputMethodManagerService: checkCscDefaultIme : mCscDefaultImePackageName is wrong
05-28 21:58:48.493 1642-1957/system_process E/InputMethodManagerService: checkCscDefaultIme : mCscDefaultImePackageName is wrong
05-28 21:58:48.834 12819-12819/com.android.inputmethod.latin E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method com.android.inputmethod.compat.UserManagerCompatUtils.<clinit>
05-28 21:58:48.844 12819-12819/com.android.inputmethod.latin E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method com.android.inputmethod.compat.UserManagerCompatUtils.getUserLockState
05-28 21:58:48.954 12819-12819/com.android.inputmethod.latin E/AndroidRuntime: FATAL EXCEPTION: main
  android.view.InflateException: Binary XML file line #2: Error inflating class com.android.inputmethod.keyboard.emoji.EmojiPalettesView
      at android.view.LayoutInflater.createView(LayoutInflater.java:619)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
      at android.view.LayoutInflater.parseInclude(LayoutInflater.java:818)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
      at com.android.inputmethod.keyboard.KeyboardSwitcher.onCreateInputView(KeyboardSwitcher.java:464)
      at com.android.inputmethod.latin.LatinIME.onCreateInputView(LatinIME.java:752)
      at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1227)
      at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1628)
      at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1595)
      at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:521)
      at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:192)
      at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:137)
      at android.app.ActivityThread.main(ActivityThread.java:4944)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:511)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
      at dalvik.system.NativeStart.main(Native Method)
   Caused by: java.lang.reflect.InvocationTargetException
      at java.lang.reflect.Constructor.constructNative(Native Method)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
      at android.view.LayoutInflater.createView(LayoutInflater.java:593)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)?
      at android.view.LayoutInflater.parseInclude(LayoutInflater.java:818)?
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)?
      at android.view.LayoutInflater.inflate(LayoutInflater.java:495)?
      at android.view.LayoutInflater.inflate(LayoutInflater.java:397)?
      at android.view.LayoutInflater.inflate(LayoutInflater.java:353)?
      at com.android.inputmethod.keyboard.KeyboardSwitcher.onCreateInputView(KeyboardSwitcher.java:464)?
      at com.android.inputmethod.latin.LatinIME.onCreateInputView(LatinIME.java:752)?
      at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1227)?
      at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1628)?
      at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1595)?
      at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:521)?
      at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:192)?
      at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)?
      at android.os.Handler.dispatchMessage(Handler.java:99)?
      at android.os.Looper.loop(Looper.java:137)?
      at android.app.ActivityThread.main(ActivityThread.java:4944)?
      at java.lang.reflect.Method.invokeNative(Native Method)?
      at java.lang.reflect.Method.invoke(Method.java:511)?
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)?
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)?
      at dalvik.system.NativeStart.main(Native Method)?
   Caused by: java.lang.UnsatisfiedLinkError: Native method not found: com.android.inputmethod.keyboard.ProximityInfo.setProximityInfoNative:(IIIIII[II[I[I[I[I[I[F[F[F)J
      at com.android.inputmethod.keyboard.ProximityInfo.setProximityInfoNative(Native Method)
      at com.android.inputmethod.keyboard.ProximityInfo.createNativeProximityInfo(ProximityInfo.java:222)
      at com.android.inputmethod.keyboard.ProximityInfo.<init>(ProximityInfo.java:81)
      at com.android.inputmethod.keyboard.Keyboard.<init>(Keyboard.java:123)
      at com.android.inputmethod.keyboard.internal.KeyboardBuilder.build(KeyboardBuilder.java:196)
      at com.android.inputmethod.keyboard.KeyboardLayoutSet.getKeyboard(KeyboardLayoutSet.java:232)
      at com.android.inputmethod.keyboard.KeyboardLayoutSet.getKeyboard(KeyboardLayoutSet.java:204)
      at com.android.inputmethod.keyboard.emoji.EmojiCategory.getKeyboard(EmojiCategory.java:374)
      at com.android.inputmethod.keyboard.emoji.EmojiCategory.addShownCategoryId(EmojiCategory.java:223)
      at com.android.inputmethod.keyboard.emoji.EmojiCategory.<init>(EmojiCategory.java:176)
      at com.android.inputmethod.keyboard.emoji.EmojiPalettesView.<init>(EmojiPalettesView.java:120)
      at com.android.inputmethod.keyboard.emoji.EmojiPalettesView.<init>(EmojiPalettesView.java:96)
      at java.lang.reflect.Constructor.constructNative(Native Method)?
      at java.lang.reflect.Constructor.newInstance(Constructor.java:417)?
      at android.view.LayoutInflater.createView(LayoutInflater.java:593)?
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)?
      at android.view.LayoutInflater.parseInclude(LayoutInflater.java:818)?
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)?
      at android.view.LayoutInflater.inflate(LayoutInflater.java:495)?
      at android.view.LayoutInflater.inflate(LayoutInflater.java:397)?
      at android.view.LayoutInflater.inflate(LayoutInflater.java:353)?
      at com.android.inputmethod.keyboard.KeyboardSwitcher.onCreateInputView(KeyboardSwitcher.java:464)?
      at com.android.inputmethod.latin.LatinIME.onCreateInputView(LatinIME.java:752)?
      at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1227)?
      at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1628)?
      at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1595)?
      at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:521)?
      at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:192)?
      at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)?
      at android.os.Handler.dispatchMessage(Handler.java:99)?
      at android.os.Looper.loop(Looper.java:137)?
      at android.app.ActivityThread.main(ActivityThread.java:4944)?
      at java.lang.reflect.Method.invokeNative(Native Method)?
      at java.lang.reflect.Method.invoke(Method.java:511)?
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)?
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)?
      at dalvik.system.NativeStart.main(Native Method)?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your screenshot suggests that your jniLibs contains a jar file with prebuilt native library. I did not know that this is even possible, but yes, it works in Android Studio 2.3 and higher. Nice!

Anyways, as I explained elsewhere, don't expect Android Studio to resolve magically the native method declarations into a prebuilt library (even if it is unpacked into src/main/jnLibs).

You can simply ignore this error message: your APK will still install the prebuilt library, and the native method will be resolved at run time.

You can add @SuppressWarnings("JniMissingFunction") annotation for this method, or for the entire class:

@SuppressWarnings("JniMissingFunction")
public class ProximityInfo {

or configure this kind of Lint inspections for the given project, or for all projects: Preferences/Editor/Inspections


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...