关于okhttp(java.lang.NoSuchMethodError: No interface method rangeEquals(JLokio/ByteString;)Z)错误

来源:互联网 发布:扫码抵扣软件 编辑:程序博客网 时间:2024/05/03 11:02

错误信息:

E/AndroidRuntime: FATAL EXCEPTION: Thread-2322                                                                       Process: cn.vove7.sendjsondemo, PID: 18952                                                                       Theme: themes:{com.cyanogenmod.trebuchet=overlay:system, com.tencent.mobileqq=overlay:org.cyanogenmod.hexolibre, com.android.settings=overlay:system}                                                                       java.lang.NoSuchMethodError: No interface method rangeEquals(JLokio/ByteString;)Z in class Lokio/BufferedSource; or its super classes (declaration of 'okio.BufferedSource' appears in /data/app/cn.vove7.sendjsondemo-1/split_lib_dependencies_apk.apk:classes15.dex)                                                                           at okhttp3.internal.Util.bomAwareCharset(Util.java:412)                                                                           at okhttp3.ResponseBody.string(ResponseBody.java:173)                                                                           at cn.vove7.sendjsondemo.MainActivity.post(MainActivity.java:84)                                                                           at cn.vove7.sendjsondemo.MainActivity.access$000(MainActivity.java:18)                                                                           at cn.vove7.sendjsondemo.MainActivity$1$1.run(MainActivity.java:49)                                                                           at java.lang.Thread.run(Thread.java:818)

由于使用的引用外部jar包,就一直出错,

    compile files('src/main/res/lib/okhttp-3.6.0.jar')    compile files('src/main/res/lib/okio-1.6.0.jar')

换为maven依赖即可

    compile 'com.squareup.okhttp3:okhttp:3.6.0'
阅读全文
0 0
原创粉丝点击