“使用Android aar库反应Native”ClassNotFoundException:kotlin.LazyKt

时间:2018-01-18 08:43:07

标签: android react-native kotlin classnotfoundexception aar

我正在使用自己在Kotlin上完成的Android库。 我将该库构建到* .aar文件中,并在React Native上的单独项目中导入。 当我从该库启动Service时,崩溃会出现在Android React Native应用程序中,其中某些字段是通过懒惰方式初始化的。

我找不到类似于“Lkotlin / LazyKt”或“kotlin.LazyKt”的错误。也许有人遇到过类似的问题?如果有任何提示,我将不胜感激。

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.project_mobile:sdmp, PID: 18913
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/LazyKt;
    at com.project.service.SdmService.<init>(SdmService.kt:27)
    at java.lang.Class.newInstance(Native Method)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2859)
    at android.app.ActivityThread.-wrap4(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1427)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.LazyKt" on path: DexPathList[[zip file "/data/app/com.project_mobile-2/base.apk"],nativeLibraryDirectories=[/data/app/com.project_mobile-2/lib/arm, /data/app/com.project_mobile-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    at com.project.service.SdmService.<init>(SdmService.kt:27) 
    at java.lang.Class.newInstance(Native Method) 
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2859) 
    at android.app.ActivityThread.-wrap4(ActivityThread.java) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1427) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5417) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
    Suppressed: java.lang.ClassNotFoundException: kotlin.LazyKt
    at java.lang.Class.classForName(Native Method)
    at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
    at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
            ... 12 more
 Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

0 个答案:

没有答案