java.lang.NoClassDefFoundError: okhttp3.HttpUrl$Builder$ParseResult
来源:互联网 发布:淘宝模板设计教程 编辑:程序博客网 时间:2024/06/11 12:16
也是一个莫名其妙的问题,不知道怎么导致的,开始okhttp3运行的还好好地,突然抽风似的,出现这个bug。
好在网上有解决办法,我的办法来自:https://stackoverflow.com/questions/36649121/java-lang-noclassdeffounderror-okhttp3-okhttpclientbuilder
down voteacceptedYes, finally I find the problem and solve it. I viewed a similar problem here and find that maybe the 64K Methods could cause the problem, so I came to official site to view Building Apps with Over 64K Methods. Now you should compile the multidex library in your build.gradle file:compile 'com.android.support:multidex:1.0.1'And don't forget to config your defaultConfig:android { defaultConfig { multiDexEnabled true }}And finally you can write a BaseApplication extends to Application, over write the attachBaseContext(Context base) method as follows: @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); }Don't forget to add this to your AndroidManifest.xml file:<application android:name=".BaseApplication" android:allowBackup="true"></application>
加上上面这些配置,问题解决
1,multidex
compile 'com.android.support:multidex:1.0.1'
2,defaultConfig
android { defaultConfig { multiDexEnabled true }}
3,attachBaseContext()
@Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); }
4,
<application android:name=".BaseApplication" android:allowBackup="true"></application>
阅读全文
0 0
- java.lang.NoClassDefFoundError: okhttp3.HttpUrl$Builder$ParseResult
- java.lang.NoClassDefFoundError: okhttp3.MediaType
- java.lang.NoClassDefFoundError: okhttp3.Dispatcher
- java.lang.NoClassDefFoundError: okhttp3.Protocol[]
- NoClassDefFoundError: okhttp3.OkHttpClient$Builder
- okhttp源码分析,Builder.ParseResult.parse(null, url) HttpUrl.parse(url) 方法详细分析
- java.lang.NoClassDefFoundError: android.os.StrictMode$ThreadPolicy$Builder
- 使用okhttp3出现java.lang.NoClassDefFoundError: okio.Buffer的错误怎么办?
- java.lang.NoClassDefFoundError: Failed resolution of: Lio/bugtags/agent/instrumentation/okhttp3/OkHt
- java.lang.NoClassDefFoundError翻译
- java.lang.NoClassDefFoundError bshEvalError
- java.lang.NoClassDefFoundError:
- java.lang.NoClassDefFoundError记录
- java.lang.NoClassDefFoundError
- java.lang.NoClassDefFoundError
- java.lang.NoClassDefFoundError
- java.lang.NoClassDefFoundError
- maven java.lang.NoClassDefFoundError
- python opencv入门 基本图像操作(6)
- <转>获取对象属性的点方法和中括号法的区别
- dd find exec
- ]数据结构:单链表之判断两个链表是否相交及求交点(带环、不带环)
- js中几种实用的跨域方法原理详解
- java.lang.NoClassDefFoundError: okhttp3.HttpUrl$Builder$ParseResult
- Spring MVC数据处理
- 邮箱在本地能发送成功,在服务器发送失败。
- 【Deep Learning】caffe学习笔记(二):mnist
- 横向右到左圆角进度ProgressBar
- Linux join命令
- Android NDK 编译PjSip 2.6 之 测试PjSip apk(四)
- memcached--查找命令--gets
- HDU2547 Reward(拓扑排序)