[英]java.lang.NoSuchMethodError: No virtual method toString(Z)Ljava/lang/String; in class Lokhttp3/Cookie; or its super classe
[英]java.lang.NoSuchMethodError: No static method get(Ljava/lang/String;)Lokhttp3/HttpUrl; in class Lokhttp3/HttpUrl; or its super classes
在集成Small case Library之前,我的項目運行良好。 集成后,我在安裝應用程序時收到此錯誤。
java.lang.NoSuchMethodError: No static method get(Ljava/lang/String;)Lokhttp3/HttpUrl; in class Lokhttp3/HttpUrl; or its super classes (declaration of 'okhttp3.HttpUrl' appears in /data/app/base.apk!classes3.dex)
at retrofit2.Retrofit$Builder.baseUrl(Retrofit.java:506)
在這里,我附上了應用程序級別的 gradle 文件。
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
packagingOptions {
exclude 'META-INF/*'
}
defaultConfig {
minSdkVersion 23
targetSdkVersion 29
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations{
all*.exclude module: 'okhttp'
all*.exclude module: 'okio'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '29.0.2'
}
dependencies {
implementation project(path: ':library')
implementation project(path: ':library')
implementation project(path: ':library')
testImplementation 'junit:junit:4.12'
implementation 'com.smallcase.gateway:sdk:2.9.3'
implementation ('com.squareup.retrofit2:retrofit:2.9.0') {
exclude module: 'okhttp'
}
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.4.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
}
正如其他答案中提到的,我已經嘗試使用 Java 1.8 設置 CompileOptions。 但沒有運氣。 任何幫助,將不勝感激。
使用最新版本 (Retrofit & OkHttp)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.