与依赖的冲突&junit:junit'。 app(3.8.2)和测试app(4.12)的已解决版本有所不同

时间:2017-07-04 13:29:22

标签: java android android-studio junit

我在编译旧Android应用程序时遇到问题。 build.gradle文件被旧开发者删除了(我不知道原因)。我设法重写它并找到了所有依赖项,但我在junit

中遇到了以下错误
  

与依赖的冲突&junit:junit'。 app(3.8.2)和测试app(4.12)的已解决版本有所不同。有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict

我的build.gradle文件内容在这里:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.blappsta.dakar7com.d7"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    // https://mvnrepository.com/artifact/de.greenrobot/greendao
    compile 'de.greenrobot:greendao:1.3.0'
    // https://mvnrepository.com/artifact/com.github.bumptech.glide/glide
    compile 'com.github.bumptech.glide:glide:3.7.0'
    testCompile 'junit:junit:4.12'
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.samwolfand.oneprefs:one-prefs:1.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.github.AndroidDeveloperLB:MaterialPreferenceLibrary:9'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    // Audience Network SDK. Only versions 4.6.0 and above are available
    compile 'com.facebook.android:audience-network-sdk:4.+'
    // Account Kit
    compile 'com.facebook.android:account-kit-sdk:4.+'
    compile 'com.facebook.fresco:fresco:1.3.0'
    compile 'com.android.support:multidex:1.0.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    compile 'com.github.stfalcon:frescoimageviewer:0.3.1'
    compile 'com.makeramen:roundedimageview:2.3.0'
    compile 'com.google.android.gms:play-services:11.0.2'
    compile 'com.squareup.picasso:picasso:2.5.2'
    // https://mvnrepository.com/artifact/com.google.guava/guava
    compile 'com.google.guava:guava:10.0.1'
    compile 'org.greenrobot:eventbus:3.0.0'
    // https://mvnrepository.com/artifact/org.jsoup/jsoup
    compile 'org.jsoup:jsoup:1.10.3'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'io.reactivex:rxandroid:1.2.1'
    // Because RxAndroid releases are few and far between, it is recommended you also

    // explicitly depend on RxJava's latest version for bug fixes and new features.
    compile 'io.reactivex.rxjava2:rxjava:2.1.0'
    compile 'com.squareup.okhttp3:okhttp:3.8.1'
    compile 'com.squareup.okhttp3:logging-interceptor:3.8.1'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.afollestad.material-dialogs:core:0.9.4.5'
    compile 'com.github.Angtrim:Android-Five-Stars-Library:v3.1'
    compile 'com.android.support:design:25.0.0'
    compile 'com.github.crosswall:Android-Coverflow:release-v1.0.4'
    compile 'com.github.devlight:infinitecycleviewpager:1.0.0'
    compile 'com.github.silvestrpredko:dot-progress-bar:1.1'
    // https://mvnrepository.com/artifact/com.github.chrisbanes.photoview/library
    compile 'com.github.chrisbanes.photoview:library:1.2.4'
    compile 'me.relex:circleindicator:1.2.2@aar'
    compile 'com.jakewharton:butterknife:8.6.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
    //compile files('libs/facebook-android-sdk-4.4.0-sources.jar')
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

我见过类似的问题,但无法找到正确的答案。如果我错过了什么,请告诉我。

NB:我的Android Studio版本是2.2.3

0 个答案:

没有答案