2016-12-13 131 views
3

我在android studio中創建了統一插件。不過,我被困在這個特殊的例外。Android ClassNotFoundException:在路徑dexpath統一插件上找不到類

當我作爲一個應用程序編譯和運行項目時,不會發生這個問題,並且只有當它作爲一個庫導出到統一時纔會發生。

以下是錯誤

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 

這裏的全部日誌貓是我在單位使用該插件定製清單:

<?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> 

我發現並試圖爲衆多解決方案這在互聯網上,但是,當應用程序被編譯爲一個統一插件時,他們都沒有解決這種情況。

回答

0

Unity無法將所有導入的庫導入到您的gradle文件中。所以你需要在Unity項目的Plugin文件夾中複製.jar文件。

相關問題