Failed resolution of: Lokhttp3/internal/http/UnrepeatableRequestBody
.....
Didn t find class okhttp3.internal.http.UnrepeatableRequestBody on path: DexPathList[[zip file /system/framework/org.apache.http.legacy.boot.jar , zip file /data/app/xxxxx-bZOGLR_BtUCgA9cDOGjkyg==/base.apk ],nativeLibraryDirectories=[/data/app/XXXXXX-bZOGLR_BtUCgA9cDOGjkyg==/lib/arm, /data/app/XXXXX-bZOGLR_BtUCgA9cDOGjkyg==/base.apk!/lib/armeabi-v7a, /system/lib, /product/lib]]
原因 :在使用okhttp版本中,版本不一致,导致jar中没有 UnrepeatableRequestBody这个文件;
切换到project,查看Gradle okhttp这个jar可以发现不用依赖版本的有细小差距的,
解决方案:向下兼容,UnrepeatableRequestBody这个类在3.14.9以上取消了,所以可以降低版本,我这降低到3.12.9。
implementation 'com.squareup.okhttp3:okhttp:3.12.9'
tip:如果其他依赖也有okhtpp,需要去除,可以参考如下:
api ('com.XXXXr:XXXX:3.2.1'){
exclude group: 'com.squareup.okhttp3'
}