gradle中的依赖冲突

问题描述 投票:0回答:1

我在翻新中遇到此冲突错误:

  java.lang.RuntimeException: java.lang.RuntimeException:
  java.lang.RuntimeException: Duplicate class okhttp3.Address found in
  modules okhttp-3.12.0.jar (com.squareup.okhttp3:okhttp:3.12.0) and
  pubnub-gson-4.19.0-all.jar
  (pubnub-gson-4.19.0-all.jar).lang.RuntimeException: Duplicate class
  okhttp3.Address found in modules okhttp-3.12.0.jar
  (com.squareup.okhttp3:okhttp:3.12.0) and pubnub-gson-4.19.0-all.jar
  (pubnub-gson-4.19.0-all.jar)

这是我的gradle文件,包含所有依赖项:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
//    buildToolsVersion '27.0.3'
//    useLibrary 'org.apache.http.legacy'
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }


    defaultConfig {
        applicationId "com.chaufferapplication"
        minSdkVersion 19
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 38
        versionName "4.6.6.0"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    lintOptions {
        // Returns whether lint should be quiet (for example, not write informational messages such as paths to report files written)
        quiet true

        // Whether lint should set the exit code of the process if errors are found
        abortOnError false

        // Returns whether lint will only check for errors (ignoring warnings)
        ignoreWarnings true

        // Returns whether lint should check for fatal errors during release builds. Default is true.
        // If issues with severity "fatal" are found, the release build is aborted.
        checkReleaseBuilds false
    }
}

dependencies {
    implementation files('libs/json-20140107.jar')
    implementation files('libs/mobiprobe7.0.jar')
    implementation files('libs/pubnub-gson-4.19.0-all.jar'){
        configurations {
            compile.exclude module: 'okhttp3'
        }
    }
    annotationProcessor files('libs/pubnub-gson-4.19.0-all.jar'){
        configurations {
            compile.exclude module: 'okhttp3'
        }
    }
    implementation files('libs/test.jar')
    implementation files('libs/WebSocket.jar')
    implementation 'com.mikhaellopez:circularimageview:3.2.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.android.gms:play-services-places:17.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-analytics:17.0.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation "se.emilsjolander:stickylistheaders:2.7.0"
    implementation 'me.grantland:autofittextview:0.2.+'
    implementation 'org.droidparts:droidparts:2.9.6'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'me.tankery.lib:circularSeekBar:1.1.7'
    implementation 'ch.acra:acra:4.9.0'
    implementation 'com.google.maps.android:android-maps-utils:0.5+'
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation 'com.googlecode.libphonenumber:libphonenumber:8.2.0'
    implementation 'me.biubiubiu.justifytext:library:1.1'
    implementation 'org.jsoup:jsoup:1.11.3'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:2.6.1"
   // implementation "com.squareup.retrofit2:converter-gson:2.6.1"
    implementation "com.squareup.retrofit2:converter-scalars:2.6.1"

}
apply plugin: 'com.google.gms.google-services'

[在运行应用程序时,我遇到了改装和PubNub冲突的错误。有人对此有解决方案吗?我也尝试排除okhttp3,但仍然无法正常工作并引发错误。改造是一个依赖项,而pubnub是一个jar文件,并且两者都具有okhttp3作为通用模块,并且由于具有相同的模块而发生冲突。

android gradle retrofit pubnub
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.