Unity无法同步android项目的gradle

时间:2017-06-13 09:04:42

标签: android unity3d gradle

我在gradle文件中编译了okttp,我可以在我的活动中调用OKHTTP对象。但是当我制作aar文件并将其导入Unity Project时 - >构建APK文件并运行 - >应用程序崩溃了。我尝试了很多其他库,但它也是一样的错误。 这是日志:

06-13 16:35:10.610 32314-32314/? E/AndroidRuntime: FATAL EXCEPTION: main
                                               Process: jp.tsutayamovie, PID: 32314
                                               java.lang.Error: FATAL EXCEPTION [main]
                                               Unity version     : 5.4.4f1
                                               Device model      : LGE Nexus 5
                                               Device fingerprint: google/hammerhead/hammerhead:6.0.1/M4B30Z/3437181:user/release-keys

                                               Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/OkHttpClient;
                                                   at com.jlabs.pluginplayer.PlayerActivity.onCreate(PlayerActivity.java:288)
                                                   at android.app.Activity.performCreate(Activity.java:6251)
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                   at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                   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 “okhttp3.OkHttpClient” on path: DexPathList[[zip file “/data/app/jp.tsutayamovie-1/base.apk”],nativeLibraryDirectories=[/data/app/jp.tsutayamovie-1/lib/arm, /data/app/jp.tsutayamovie-1/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.jlabs.pluginplayer.PlayerActivity.onCreate(PlayerActivity.java:288) 
                                                   at android.app.Activity.performCreate(Activity.java:6251) 
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                   at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                   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: okhttp3.OkHttpClient
                                                   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)
                                                        ... 14 more
                                                Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

每个人都知道为什么?我怎么固定?

0 个答案:

没有答案