我的应用程序作为调试应用程序运行良好,但是当我构建签名的apk时,代码崩溃

时间:2018-12-11 18:10:09

标签: android unsigned signed

以下是该问题的logcat错误跟踪,请提供帮助。它显示了一些JNI问题(我未在应用程序中使用progard)

12-11 23:32:53.276 27802-27802/com.verifyme.dev.VerifyMeAuthenticator E/art: JNI DETECTED ERROR IN APPLICATION: JNI FindClass called with pending exception java.lang.NoSuchFieldError: no "J" field "a" in class "Lcom/keylemon/kauth/a;" or its superclasses
        at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
        at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1072)
        at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.String) (Runtime.java:987)
        at void java.lang.System.loadLibrary(java.lang.String) (System.java:1530)
        at void com.keylemon.kauth.a.<clinit>() ((null):-1)
        at void com.keylemon.oasis.face.f.<init>(android.content.Context, com.keylemon.oasis.face.a$h) ((null):-1)
        at void com.keylemon.oasis.face.a.<init>(android.content.Context, com.keylemon.oasis.face.a$h) ((null):-1)
        at void com.verifyme.dev.VerifyMeAuthenticator.activity.verify.VerifyOasis.onCreate(android.os.Bundle) ((null):-1)
        at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6689)
        at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1140)
        at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2709)
        at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2825)
        at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
        at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1557)
        at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:110)
        at void android.os.Looper.loop() (Looper.java:203)
        at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6343)
        at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
        at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1084)
        at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:945)
        in call to FindClass
        from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String)
    "main" prio=5 tid=1 Runnable
      | group="main" sCount=0 dsCount=0 obj=0x765394b0 self=0x7f9169aa00
      | sysTid=27802 nice=-10 cgrp=default sched=0/0 handle=0x7f95d9ca98
      | state=R schedstat=( 933864557 43675457 577 ) utm=72 stm=20 core=4 HZ=100
      | stack=0x7fec865000-0x7fec867000 stackSize=8MB
      | held mutexes= "mutator lock"(shared held)
      native: #00 pc 0000000000481884  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+220)
      native: #01 pc 0000000000481880  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+216)
      native: #02 pc 0000000000455a04  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+480)
      native: #03 pc 00000000002f2568  /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1560)
      native: #04 pc 00000000002f3b50  /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+124)
      native: #05 pc 0000000000102d98  /system/lib64/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+156)
      native: #06 pc 00000000001027a8  /system/lib64/libart.so (_ZN3art11ScopedCheck11CheckThreadEP7_JNIEnv+536)
12-11 23:32:53.277 27802-27802/com.verifyme.dev.VerifyMeAuthenticator E/art:   native: #07 pc 00000000001002e8  /system/lib64/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+1124)
      native: #08 pc 00000000000f1bb8  /system/lib64/libart.so (_ZN3art8CheckJNI9FindClassEP7_JNIEnvPKc+612)
      native: #09 pc 000000000000ada0  /data/app/com.verifyme.dev.VerifyMeAuthenticator-1/lib/arm64/libkauthfacejni.so (JNI_OnLoad+1304)
      native: #10 pc 00000000002f5e30  /system/lib64/libart.so (_ZN3art9JavaVMExt17LoadNativeLibraryEP7_JNIEnvRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEP8_jobjectP8_jstringPS9_+212

崩溃开始

12-11 23:32:53.398 27802-27802/com.verifyme.dev.VerifyMeAuthenticator A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 27802 (MeAuthenticator)

1 个答案:

答案 0 :(得分:0)

经过大量检查代码后,我自己解决了该问题。

   buildTypes {
    release {
        minifyEnabled false 
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

请参见上文,只需将minifyEnabled设置为false即可。