Android 用Java语言编写,调用kotlin 的aar报错 Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
Process: com.tool.rfid, PID: 14344
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
at com.jrfid.inventory.library.ScanCodeManager.initScanCode(Unknown Source:2)
at com.tool.rfid.TestActivity.init(TestActivity.java:71)
at com.tool.rfid.TestActivity.lambda$onCreate$0$com-tool-rfid-TestActivity(TestActivity.java:49)
at com.tool.rfid.TestActivity$$ExternalSyntheticLambda0.onClick(D8$$SyntheticClass:0)
at android.view.View.performClick(View.java:7455)
at android.view.View.performClickInternal(View.java:7428)
at android.view.View.access$3600(View.java:813)
at android.view.View$PerformClick.run(View.java:28495)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7700)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[dex file "/data/data/com.tool.rfid/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~nXHUfspxCknp092hEsLEQA==/com.tool.rfid-uXbtTorcQlfbHkl3yFhulw==/base.apk"],nativeLibraryDirectories=[/data/app/~~nXHUfspxCknp092hEsLEQA==/com.tool.rfid-uXbtTorcQlfbHkl3yFhulw==/lib/arm64, /data/app/~~nXHUfspxCknp092hEsLEQA==/com.tool.rfid-uXbtTorcQlfbHkl3yFhulw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.jrfid.inventory.library.ScanCodeManager.initScanCode(Unknown Source:2)
at com.tool.rfid.TestActivity.init(TestActivity.java:71)
at com.tool.rfid.TestActivity.lambda$onCreate$0$com-tool-rfid-TestActivity(TestActivity.java:49)
at com.tool.rfid.TestActivity$$ExternalSyntheticLambda0.onClick(D8$$SyntheticClass:0)
at android.view.View.performClick(View.java:7455)
at android.view.View.performClickInternal(View.java:7428)
at android.view.View.access$3600(View.java:813)
at android.view.View$PerformClick.run(View.java:28495)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7700)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
解决方案
在 build.gradle 中添加依赖
implementation 'com.mapzen:on-the-road:1.3.1'
最新版本可以在 maven repository 中查看,地址为:https://mvnrepository.com/artifact/com.mapzen/on-the-road