gpt4 book ai didi

android - java.lang.NoClassDefFoundError : Failed resolution of: Lokhttp3/MediaType; 错误

转载 作者:行者123 更新时间:2023-11-29 20:06:16 26 4
gpt4 key购买 nike

使用 okhttp-3.0.1.jar 导致崩溃:

 02-25 17:44:33.279: E/AndroidRuntime(30263): FATAL EXCEPTION: main
02-25 17:44:33.279: E/AndroidRuntime(30263): Process:com.littleapproom.diamondapp, PID: 30263
02-25 17:44:33.279: E/AndroidRuntime(30263):java.lang.NoClassDefFoundError: Failed resolution Lokhttp3/MediaType;
02-25 17:44:33.279: E/AndroidRuntime(30263): at com.littleapproom.diamondapp.helper.ServiceTask.<clinit>(ServiceTask.java:68)
02-25 17:44:33.279: E/AndroidRuntime(30263): at com.littleapproom.diamondapp.RegisterActivity.callRegisterApi(RegisterActivity.java:74)
02-25 17:44:33.279: E/AndroidRuntime(30263): at com.littleapproom.diamondapp.RegisterActivity.onClick(RegisterActivity.java:50)
02-25 17:44:33.279: E/AndroidRuntime(30263): at android.view.View.performClick(View.java:4785)
02-25 17:44:33.279: E/AndroidRuntime(30263): at android.view.View$PerformClick.run(View.java:19884)
02-25 17:44:33.279: E/AndroidRuntime(30263): at android.os.Handler.handleCallback(Handler.java:739)
02-25 17:44:33.279: E/AndroidRuntime(30263): at android.os.Handler.dispatchMessage(Handler.java:95)
02-25 17:44:33.279: E/AndroidRuntime(30263): at android.os.Looper.loop(Looper.java:135)
02-25 17:44:33.279: E/AndroidRuntime(30263): at android.app.ActivityThread.main(ActivityThread.java:5343)
02-25 17:44:33.279: E/AndroidRuntime(30263): at java.lang.reflect.Method.invoke(Native Method)
02-25 17:44:33.279: E/AndroidRuntime(30263): at java.lang.reflect.Method.invoke(Method.java:372)
02-25 17:44:33.279: E/AndroidRuntime(30263): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
02-25 17:44:33.279: E/AndroidRuntime(30263): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
02-25 17:44:33.279: E/AndroidRuntime(30263): Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.MediaType" on path: DexPathList[[zip file "/data/app/com.littleapproom.diamondapp-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
02-25 17:44:33.279: E/AndroidRuntime(30263): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
02-25 17:44:33.279: E/AndroidRuntime(30263): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
02-25 17:44:33.279: E/AndroidRuntime(30263): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
02-25 17:44:33.279: E/AndroidRuntime(30263): ... 13 more
02-25 17:44:33.279: E/AndroidRuntime(30263): Suppressed: java.lang.ClassNotFoundException: okhttp3.MediaType
02-25 17:44:33.279: E/AndroidRuntime(30263): at java.lang.Class.classForName(Native Method)
02-25 17:44:33.279: E/AndroidRuntime(30263): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
02-25 17:44:33.279: E/AndroidRuntime(30263): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
02-25 17:44:33.279: E/AndroidRuntime(30263): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
02-25 17:44:33.279: E/AndroidRuntime(30263): ... 14 more
02-25 17:44:33.279: E/AndroidRuntime(30263): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

okhttp-3.0.1.jar 工作正常并且有这个缺失的类。请帮忙解决。

最佳答案

这可能不是答案。我没有足够的 Rep 发表评论,因此我将其作为答案。

您是否导入了可能使用 okhttp 的自定义库,或者您是否直接在您的项目中使用 okhttp?我在导入可能使用 okhttp 的库时也遇到了这个问题。我必须明确地将 okhttp 包含到我的 gradle 中以克服这个问题,尽管我没有在我的代码中使用它但导入的 aar 使用了它。您的情况可能不同,但分享更多相关信息(例如您的项目结构和相关代码)可能有助于解决此问题。

关于android - java.lang.NoClassDefFoundError : Failed resolution of: Lokhttp3/MediaType; 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35627123/

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