java - 与项目 'com.android.support:support-media-compat' 中的依赖项 ':app' 冲突

标签 java android unit-testing testing

当我尝试开始测试时出现此错误:

Conflict with dependency 'com.android.support:support-media-compat' in project ':app'. Resolved versions for app (27.0.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

这是我的 build.gradle 依赖项:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'

    // ViewModel and LiveData
    implementation "android.arch.lifecycle:extensions:1.1.1"
    annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
    // ButterKnife Library
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    // Gson Library
    implementation 'com.google.code.gson:gson:2.8.5'
    // Glide Library
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    // ExoPlayer Library
    implementation 'com.google.android.exoplayer:exoplayer-core:2.8.3'
    implementation 'com.google.android.exoplayer:exoplayer-ui:2.8.3'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation "com.android.support.test:rules:1.0.2"
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support:support-annotations:27.1.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
}

我在我的代码中没有看到使用版本 27.0.0,我认为 ExoPlayer 可能在内部使用该版本!我可以做些什么来解决冲突?!

最佳答案

在你的gradle文件中使用依赖

implementation 'com.android.support:support-media-compat:27.1.1'

关于java - 与项目 'com.android.support:support-media-compat' 中的依赖项 ':app' 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52094476/

相关文章:

java - 如何以动态大小居中 JPanel

android - 可以指定 TextView 文本以缩放以适合 TextView 吗?

java - Espresso 'is enabled' 与所选 View 不匹配

android - Firestore 客户和发票,修订后的要求

python - 使用 atol 和 pandas assert_frame_equal 意外通过测试

node.js - Jest 模拟和测试 require.resolve 调用

java - 当一个线程修改全局变量时,另一个线程也可以看到它吗?

java - 网络上的套接字

unit-testing - 假对象与模拟对象

java - 如何使用JPDA调试jmeter-server?