okhttp(java.lang.NoSuchMethodError: No interface method rangeEquals(JLokio/ByteString;)Z) 오류

3901 단어 ERROR
오류 정보:
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')

gradle 의존으로 바꾸면 됩니다.

    compile 'com.squareup.okhttp3:okhttp:3.6.0'

좋은 웹페이지 즐겨찾기