更新到android studio 2.3后,我收到了这个错误消息。我知道这只是一个提示,因为应用程序运行正常,但这真的很奇怪。

所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本25.1.1、24.0.0。示例包括com.android.support:animatedvector-drawable:25.1.1和com.android.com/support:mediarouter-v7:24.0.0

我的成绩:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.android.support:support-v4:25.1.1'
    compile 'com.android.support:design:25.1.1'
    compile 'com.android.support:recyclerview-v7:25.1.1'
    compile 'com.android.support:cardview-v7:25.1.1'
    compile 'com.google.android.gms:play-services-maps:10.2.0'
    compile 'com.google.android.gms:play-services:10.2.0'

    compile 'io.reactivex.rxjava2:rxjava:2.0.1'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'com.jakewharton:butterknife:8.4.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    compile 'com.blankj:utilcode:1.3.6'
    compile 'com.orhanobut:logger:1.15'
    compile 'com.facebook.stetho:stetho:1.4.2'

    provided 'com.google.auto.value:auto-value:1.2'
    annotationProcessor 'com.google.auto.value:auto-value:1.2'
    annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'

    compile 'com.mikepenz:iconics-core:2.8.2@aar'
    compile('com.mikepenz:materialdrawer:5.8.1@aar') { transitive = true }
    compile 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar'
    compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'
    compile 'com.github.GrenderG:Toasty:1.1.1'
    compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.8.0'
    compile 'com.github.MAXDeliveryNG:slideview:1.0.0'

    compile 'com.facebook.fresco:fresco:1.0.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'

    compile 'com.google.maps.android:android-maps-utils:0.4.4'
    compile 'com.github.jd-alexander:library:1.1.0'
}

当前回答

对我来说,我通过添加:compile“com.android.support:design:<version>”解决了错误

其他回答

所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本25.1.1、24.0.0。示例包括com.android.support:animatedvector-drawable:25.1.1和com.android.com/support:mediarouter-v7:24.0.0

当我们使用Google Play Services时,通常会出现此警告,因为它使用支持库作为依赖项。

我们大多数人都不知道我们可以覆盖Google Play Services中使用的支持库。当我们使用以下依赖项时:

implementation "com.android.support:animated-vector-drawable:25.1.1"

它隐含地依赖于com.android.support:mediarouter-v7:25.1.1。但它与谷歌Play服务的依赖性冲突,后者是com.android.support:mediarouter-v7:24.0.0。因此,我们需要通过显式使用库来重写它:

implementation "com.android.support:mediarouter-v7:25.1.1"

然后,依赖项块将包括这两个项,如下所示:

dependencies {
    implementation "com.android.support:animated-vector-drawable:25.1.1"
    implementation "com.android.support:mediarouter-v7:25.1.1"

    ...
}

将以下实现语句添加到依赖项部分。(如果它显示一些App Compat库不匹配错误,那么我们必须重新实现所有不匹配的支持库。我们可以通过将光标放在错误上找到不匹配的库。按快捷键ctrl+F1在android studio中显示完整的详细信息。)

implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:asynclayoutinflater:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'

包括以下行:

implementation 'com.android.support:support-v4:27.1.1'

确保您正在使用android studio插件3+

如果appcompat上出现相同错误

implementation 'com.android.support:appcompat-v7:27.0.1'

然后添加设计解决了这个问题。

implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:design:27.0.1'

对我来说

implementation 'de.mrmaffen:vlc-android-sdk:2.0.6'

包括appcompat-v7:23.1.1

.didea/库

没有vlc,仅appcompat就足够了。

在搜索和组合答案后,2018年版本的这个问题对我很有用:

1) 在导航选项卡上,将其更改为项目视图

2) 导航到[YourProjectName]/.didea/libraries/

3) 删除以Gradle__com_android_support_[libraryName]开头的所有文件

例如:Gradle__com_android_support_animed_vector_drawable_26__0.xml

4) 在渐变文件中定义一个变量,并使用它来替换版本号,如${variableName}

Def变量:

ext {
    support_library_version = '28.0.0' //use the version of choice
}

使用变量:

implementation "com.android.support:cardview-v7:${support_library_version}"

示例渐变:

dependencies {
    ext {
        support_library_version = '28.0.0' //use the version of choice
    }

    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation "com.android.support:animated-vector-drawable:${support_library_version}"
    implementation "com.android.support:appcompat-v7:${support_library_version}"
    implementation "com.android.support:customtabs:${support_library_version}"
    implementation "com.android.support:cardview-v7:${support_library_version}"
    implementation "com.android.support:support-compat:${support_library_version}"
    implementation "com.android.support:support-v4:${support_library_version}"
    implementation "com.android.support:support-core-utils:${support_library_version}"
    implementation "com.android.support:support-core-ui:${support_library_version}"
    implementation "com.android.support:support-fragment:${support_library_version}"
    implementation "com.android.support:support-media-compat:${support_library_version}"
    implementation "com.android.support:appcompat-v7:${support_library_version}"
    implementation "com.android.support:recyclerview-v7:${support_library_version}"
    implementation "com.android.support:design:${support_library_version}"

}