gradle 原因:java.lang.运行时异常:在模块中找到重复的类com.squareup.okhttp.Address

cgh8pdjw  于 2023-03-30  发布在  Java
关注(0)|答案(1)|浏览(212)

我有一个问题,我还没有能够找到一个出路,即使我尝试了一些解决办法在互联网上。
在将名为enverify.aar的sdk添加到我当前的项目后,我开始收到以下错误。
screenshot of the error
这是错误“导致原因:java.lang.RuntimeException:重复的类com.squareup.okhttp。在模块jetified-enverify-runtime(enverify.aar)和jetified-okhttp-2.7.5(com.squareup.okhttp:okhttp:2.7.5)中找到地址“
除了这个错误,还有一个错误。
Caused by:com.android.builder.merge.DuplicateRelativeFileException:从输入中找到2个文件,路径为“org/threeten/bp/TZDB.dat”:screenshot of the error
我的build.gradle(:app)代码如下

dependencies {
    def lifecycle_version = "2.5.1"
    def nav_version = "2.5.3"

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.6.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation project(path: ':TurkOnayWalletApi')
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation "androidx.preference:preference-ktx:1.2.0"
    implementation files('libs/EnwalletSDK-debug.aar')
    implementation files('libs/enverify.aar')

    //navigation
    implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
    implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
    //sdp
    implementation 'com.intuit.sdp:sdp-android:1.0.6'
    //chart
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    //service
    implementation 'com.google.code.gson:gson:2.9.0'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.2'
    implementation("com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2")
    //circleindicator
    implementation 'me.relex:circleindicator:1.3.2'
    //threetenbp
    implementation 'org.threeten:threetenbp:1.3.5'
    //circleimageview
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    //android-pdf-viewer
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
    //CurrencyEditText
    implementation 'com.cottacush:CurrencyEditText:0.0.10'

    // Lifecycle
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

    //Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"

    implementation 'com.params.progressview:step-progress:1.0.2'
    implementation 'com.github.igortrncic.dotted-progress-bar:library:1.0.0'

    //Dependency Injection
    implementation "com.google.dagger:hilt-android:2.44"
    kapt "com.google.dagger:hilt-compiler:2.44"

}

我试着解决这个问题,但它没有工作[错误](https://i.stack.imgur.com/eYwtz.png

hzbexzde

hzbexzde1#

经过一番努力,我解决了我的问题。
build.gradle(:app)
我将implementation files('libs/enverify.aar')代码替换为以下implementation project(path: ':enVerifySDK')代码片段。
我还将此代码添加到
settings.gradle中的include ':enVerifySDK'

当然,除了这些代码之外,我还在项目的根目录下创建了一个名为enVerifySDK的文件夹,并将我的.aar文件放入该文件夹。
这样,重复的类就被修复了。

相关问题