首页 > 解决方案 > 所有 com.android.support 库必须使用完全相同的版本规范。找到版本 28.0.0、26.1.0

问题描述

所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 28.0.0、26.1.0。示例包括 com.android.support:animated-vector-drawable:28.0.0 和 com.android.support:support-media-compat:26.1.0 less (Ctrl+F1) 有一些库的组合,或者工具和库,不兼容或可能导致错误。一种这样的不兼容性是使用不是最新版本的 Android 支持库版本(或者特别是低于您的 targetSdkVersion 的版本)进行编译。问题 ID:GradleCompatible 问题 ID:GradleCompatible

build.gradle 中的依赖

dependencies {
    implementation fileTree(dir:'libs',include:['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    testImplementation'junit:junit:4.12'   
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
}

标签: androidandroid-studioandroid-gradle-plugin

解决方案


您可以通过添加具有以下内容的库来消除错误:

dependencies {
  implementation 'com.android.support:animated-vector-drawable:28.0.0'
  implementation 'com.android.support:support-media-compat:28.0.0'
} 

推荐阅读