2017-05-27 3 views
0

Je construis LatinIME code source fourni par google-source en studio Android mais je m'y suis un bogue dans ProximityInfo.java ligne 89 qui montrent une boîte de dialogue like this et moi avons ajouté un jni_latinime.so dans src/main/jniLibs like this. Mais le bug n'est toujours pas corrigé. Quelle erreur j'ai faite et que devrais-je faire maintenant?ne peut pas résoudre correspondant JNI Fonction Java_com_android_inputmethod_keyboard_ProximityInfo_setProximityInfoNative

Erreur

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)  

Répondre

1

Votre capture d'écran suggère que votre jniLibs contient un fichier jar avec bibliothèque native préconstruits. Je ne savais pas que c'est même possible, mais oui, cela fonctionne dans Android Studio 2.3 et supérieur. Agréable! Quoi qu'il en soit, comme je l'ai expliqué elsewhere, je ne m'attends pas à ce que Android Studio résolve magiquement les déclarations de méthode natives dans une bibliothèque prédéfinie (même si elle est décompressée en src/main/jnLibs).

Vous pouvez simplement ignorer ce message d'erreur: votre fichier APK installera toujours la bibliothèque prédéfinie et la méthode native sera résolue au moment de l'exécution.

Vous pouvez ajouter une annotation @SuppressWarnings("JniMissingFunction") pour cette méthode, ou pour toute la classe:

@SuppressWarnings("JniMissingFunction") 
public class ProximityInfo { 

ou configurer ce type d'inspections Lint pour le projet donné, ou pour tous les projets: Preferences/Editor/Inspections

+0

je l'ai fait comme vous l'avez dit, mais cela n'a pas fonctionné.Quand je lance l'application, je reçois erreur.J'ai inclus l'erreur en question, s'il vous plaît revoir it.thanks –

+0

OK, ceci est une histoire très différente. Si nous pensons que le message d'erreur que vous avez posté, ** libjni_latinime.so ** n'a pas pu être chargé. Si le fichier est présent dans votre APK (utilisez Android Studio * analyser APK * pour vérifier), alors peut-être que cela ne correspond pas à votre appareil. Quel appareil utilisez-vous? –

+0

J'utilise lenovo thinkpad laptop et samsung galaxy fame smartphone.je ne pense pas que cela dépende des appareils. –