gpt4 book ai didi

java - 安卓 ClassNotFoundException : Didn't find class on path dexpath unity plugin

转载 作者:太空狗 更新时间:2023-10-29 13:10:58 27 4
gpt4 key购买 nike

我正在 android studio 中创建一个统一插件。但是我坚持这个特殊的异常(exception)。

当我将项目作为应用程序编译和运行时,问题不会发生,只有当它作为库导出到 unity 时才会发生。

这里是错误的完整Log cat

com.livefurnish.livefurnish E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.livefurnish.livefurnish, PID: 28640
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.livefurnish.livefurnish/com.livefurnish.livefurnish.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.livefurnish.livefurnish.MainActivity" on path: DexPathList[[zip file "/data/app/com.livefurnish.livefurnish-2/base.apk"],nativeLibraryDirectories=[/data/app/com.livefurnish.livefurnish-2/lib/arm, /system/fake-libs, /data/app/com.livefurnish.livefurnish-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2567)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.livefurnish.livefurnish.MainActivity" on path: DexPathList[[zip file "/data/app/com.livefurnish.livefurnish-2/base.apk"],nativeLibraryDirectories=[/data/app/com.livefurnish.livefurnish-2/lib/arm, /system/fake-libs, /data/app/com.livefurnish.livefurnish-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6126) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/GoogleApiClient$OnConnectionFailedListener;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
... 12 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.GoogleApiClient$OnConnectionFailedListener" on path: DexPathList[[zip file "/data/app/com.livefurnish.livefurnish-2/base.apk"],nativeLibraryDirectories=[/data/app/com.livefurnish.livefurnish-2/lib/arm, /system/fake-libs, /data/app/com.livefurnish.livefurnish-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 15 more

这是我统一用于插件的自定义 list :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.livefurnish.livefurnish" android:versionName="1.0" android:versionCode="1">
<uses-sdk android:minSdkVersion="19" />
<application android:label="@string/app_name">
<activity android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

我在互联网上找到并尝试了很多解决方案,但是没有一个解决了将应用程序编译为 unity 插件的情况。

最佳答案

Unity 无法导入您的 gradle 文件中所有已导入的库。所以你需要将 .jar 文件复制到你的 Unity 项目的 Plugin 文件夹中

关于java - 安卓 ClassNotFoundException : Didn't find class on path dexpath unity plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41119278/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com