更新到 android studio 2.3 后,我收到此错误消息。我知道这只是一个提示,因为应用程序运行正常,但这真的很奇怪。
所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 25.1.1、24.0.0。示例包括 com.android.support:animated-vector-drawable:25.1.1 和 com.android.support:mediarouter-v7:24.0.0
https://i.stack.imgur.com/trji5.png
我的毕业生:
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'
}
您可以使用以下解决方案之一解决此问题:
更新:
https://i.stack.imgur.com/BObtK.png
所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 27.0.2、26.1.0。示例包括 com.android.support:animated-vector-drawable:27.0.2 和 com.android.support:customtabs:26.1.0 存在一些不兼容或可能导致错误的库或工具和库的组合.一种这样的不兼容性是使用不是最新版本的 Android 支持库版本(或者特别是低于您的 targetSdkVersion 的版本)进行编译。
解决方案:
使用旧版本显式添加库,但使用新版本号。
在我的情况下是 com.android.support:customtabs:26.1.0
,所以我需要添加:
implementation "com.android.support:customtabs:27.0.2"
即:从第二项中获取库,并使用第一项中的版本号实现它。
注意:不要忘记现在按同步,以便 gradle 可以重建依赖关系图并查看是否还有更多冲突。
说明:
您可能会对错误消息感到困惑,因为不要使用 customtabs
所以我怎么会有冲突!
好吧..您没有直接使用它但是您的一个库在内部使用旧版本的 customtabs
,因此您需要直接请求它。
如果您想知道您的哪些库负责旧版本,并且可能要求作者更新他的库,请运行 Gradle 依赖关系报告,请参阅旧答案以了解如何操作。
注意这个
老答案:
受 CommonsWare answer 启发:
运行 Gradle 依赖关系报告以查看完整的依赖关系树是什么。
从那里,您将看到您的哪个库要求使用不同版本的 Android 支持库。无论它要求什么,您都可以直接使用 25.2.0 版本来要求它,或者使用 Gradle 的其他冲突解决方法来获得相同的版本。
更新:
从 gradle 插件版本开始:3.0 compile
已被 implementation
或 api
替换,请参阅 this answer 了解区别。
因此改用:
./gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath
或者对于 Windows cmd:
gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath
并搜索冲突的版本。
对我来说,删除 com.google.android.gms:play-services:10.2.0
后错误消失了
并且仅包括 com.google.android.gms:play-services-location:10.2.0
和 com.google.android.gms:play-services-maps:10.2.0
,因为它们是我使用的仅有的两个播放服务。
我认为 gms:play-services
依赖于支持库的一些旧组件,因此我们需要自己显式添加它们。
对于 AS 3.0 更早的版本。
跑:
./gradlew -q dependencies <module-name>:dependencies --configuration implementation
例子:
./gradlew -q dependencies app:dependencies --configuration implementation
如果有人知道新 gradle 插件中的更好方法,请告诉我。
转到文件系统上的 project/.idea/libraries 文件夹,查看哪些库不同。您必须在 build.gradle 文件中手动包含这些具有相同版本的库。然后,同步您的项目。
例如:
compile 'com.android.support:appcompat-v7:25.2.0'
// Wrong library version found on 1st point
compile 'com.android.support:customtabs:25.2.0'
对于所有情况,不仅仅是这些版本或库:
注意说明错误的小信息窗口,它说明了您必须更改和添加的示例。
在这种情况下:
找到版本 25.1.1、24.0.0。示例包括 com.android.support:animated-vector-drawable:25.1.1 和 com.android.support:mediarouter-v7:24.0.0
您的
com.android.support:animated-vector-drawable:25.1.1
是版本 25.1.1,而您的
com.android.support:mediarouter-v7:24.0.0
是版本24.0.0,所以你必须添加相同版本的媒体路由器:
com.android.support:mediarouter-v7:25.1.1
并为小信息窗口所说的每个示例执行此操作,在这种情况下,所有没有版本 25.1.1 的库。
修复指定的库后,您必须同步 gradle 以查看您必须更改的下一个库和包。
重要提示:如果您没有显式使用一个或多个指定的库并且它给您错误,这意味着它正在被另一个库内部使用,无论如何都要显式编译它。
您还可以使用另一种方法来查看您实际编译的所有库的版本差异(例如运行 gradle 依赖报告或转到您的库文件),真正的目标是编译您正在使用的所有库相同的版本。
support:mediarouter
到底是做什么的吗?
解决问题的最佳方法是实现 Android Studio 建议的所有 'com.android.support:...'
(无论您使用哪个支持版本 - 27.1.1、28.0.0 等)
将光标置于错误行,例如
implementation 'com.android.support:appcompat-v7:28.0.0'
Android Studio 会建议您哪个 'com.android.support:...' 与 'com.android.support:appcompat-v7:28.0.0' 的版本不同
例子
所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 28.0.0、27.1.0、27.0.2。示例包括 com.android.support:animated-vector-drawable:28.0.0 和 com.android.support:exifinterface:27.1.0
所以添加 com.android.support:animated-vector-drawable:28.0.0
& com.android.support:exifinterface:28.0.0
。现在同步 gradle 文件。
一一尝试实现所有建议的 'com.android.support:...' 直到此行 implementation 'com.android.support:appcompat-v7:28.0.0'
没有错误
就我而言,我添加了
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
所有这些依赖项,对您来说可能会有所不同。
将此添加到 build.gradle (Module:app) 的最后:
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.1'
}
}
}
}
确保将“25.3.1”替换为要用于所有依赖项的 android 支持库的版本,它不应低于您的编译 sdk 版本
比重新同步 gradle
更新到 Android Studio 2.3 后我遇到了完全相同的问题
将此行添加到依赖项解决了我的问题:
compile 'com.android.support:customtabs:25.2.0'
renderscriptSupportModeEnabled false
设置为 false。并添加了编译 'com.android.support:customtabs:25.2.0'
并且错误消失了。
A) 运行 gradle dependencies
或 ./gradlew dependencies
B)查看您的树并找出您的哪些依赖项为您无法控制的依赖项指定了不同的支持库版本。
我没有意识到如果您自己的代码直接完全未使用依赖项,也会显示此警告。在我的例子中,Facebook 指定了一些我没有使用的支持库,您可以在下面看到大多数这些依赖项都被我自己的 25.2.0 规范覆盖,由 -> XXX (*) 符号表示。卡片视图和自定义选项卡库没有被任何人覆盖,因此即使我不使用它们,我也需要自己为这些库请求 25.2.0。
+--- com.facebook.android:facebook-android-sdk:4.17.0
| +--- com.android.support:support-v4:25.0.0 -> 25.2.0 (*)
| +--- com.android.support:appcompat-v7:25.0.0 -> 25.2.0 (*)
| +--- com.android.support:cardview-v7:25.0.0
| | \--- com.android.support:support-annotations:25.0.0 -> 25.2.0
| +--- com.android.support:customtabs:25.0.0
| | +--- com.android.support:support-compat:25.0.0 -> 25.2.0 (*)
| | \--- com.android.support:support-annotations:25.0.0 -> 25.2.0
| \--- com.parse.bolts:bolts-android:1.4.0 (*)
如果 gradle 已经警告过你并给了你例子......
示例包括 com.android.support:animated-vector-drawable:25.1.1 和 com.android.support:mediarouter-v7:24.0.0
...如果您为较低版本添加一些 grep 突出显示会更容易,因为 gradle dependencies
可能非常冗长:
./gradlew dependencies | grep --color -E 'com.android.support:mediarouter-v7|$'
使用变量:执行以下操作将使您更容易确保对所有库使用相同的版本
dependencies {
ext {
support_library_version = '25.2.0'
google_play_services_version = '10.2.0'
}
//#####################################################################
// Support Library
//#####################################################################
compile "com.android.support:appcompat-v7:${support_library_version}"
compile "com.android.support:palette-v7:${support_library_version}"
compile "com.android.support:design:${support_library_version}"
//#####################################################################
// Google Play Services
//#####################################################################
compile "com.google.android.gms:play-services-auth:${google_play_services_version}"
compile "com.google.android.gms:play-services-ads:${google_play_services_version}"
compile "com.google.android.gms:play-services-analytics:${google_play_services_version}"
//#####################################################################
// Firebase
//#####################################################################
compile "com.google.firebase:firebase-core:${google_play_services_version}"
compile "com.google.firebase:firebase-auth:${google_play_services_version}"
compile "com.google.firebase:firebase-messaging:${google_play_services_version}"
有关 Google 建议您如何处理此版本控制的更多信息,请参阅本文:https://developer.android.com/studio/build/index.html#top-level
只需添加以下内容:
compile 'com.android.support:mediarouter-v7:25.2.0'
Updated
用于新的 SDK 版本
compile 'com.android.support:mediarouter-v7:28.0.0-alpha3'
正如您已经看到上面的所有答案和评论,但这个答案是为了清除新开发人员可能不容易获得的东西。
./gradlew -q dependencies app:dependencies --configuration 编译
毫无疑问,以上行将挽救您的生命,但如何从以上行的结果中获得确切的点。
当您从上述命令中获取所有依赖关系图表或列表时,您必须搜索您在代码中获得的冲突版本号。请看下图。
https://i.stack.imgur.com/cofxy.png
在上图中,您可以看到 23.4.0 正在造成问题,但我们无法在我们的 gradle 文件中找到它。所以现在这个版本号(23.4.0)将拯救我们。当我们有这个数字时,我们将在上述命令结果的结果中找到这个数字,并直接在我们的 gradle 文件中直接导入该依赖项。请参阅下图以获得清晰的视图。
https://i.stack.imgur.com/ujcNX.png
您可以清楚地看到 com.android.support:cardview-v7:23.4.0 和 com.android.support:customtabs:23.4.0 正在使用产生问题的版本。现在只需从依赖列表中复制这些行并在我们的 gradle 文件中显式使用,但使用更新的版本链接
实施“com.android.support:cardview-v7:26.1.0”实施“com.android.support:customtabs:26.1.0”
如果 appcompat
上出现相同的错误
implementation 'com.android.support:appcompat-v7:27.0.1'
然后添加 design
解决了它。
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
.idea/库
没有 vlc
,只有 appcompat
就足够了。
解决冲突的另一种方法是为所有依赖项强制使用正确的版本,如下所示:
dependencies {
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.android.support' && details.requested.name == 'support-v4') {
details.useVersion "27.0.2"
}
}
...
}
https://docs.gradle.org/current/userguide/customizing_dependency_resolution_behavior.html
使用 support-v13 而不是 support-v4
compile 'com.android.support:support-v13:25.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:support-v13:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
在应用级依赖项中添加这些
implementation 'com.android.support:asynclayoutinflater:28.0.0'
implementation 'com.android.support:exifinterface: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'
我的问题和你的类似。这里存在错误!
compile 'com.android.support:appcompat-v7:25.3.0'
所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 25.3.0、24.0.0。示例包括“com.android.support:animated-vector-drawable:25.3.0”和“com.android.support:mediarouter-v7:24.0.0”
看到这个例子包括'com.android.support:animated-vector-drawable:25.3.0'和'com.android.support:mediarouter-v7:24.0.0'
只需在依赖项中添加这些代码,确保版本相同。
compile 'com.android.support:animated-vector-drawable:25.3.0'
compile 'com.android.support:mediarouter-v7:25.3.0'
在使用编译 'com.android.support:appcompat-v7:25.3.1'
添加 compile 'com.google.android.gms:play-services:10.2.4'
后,我得到了同样的错误。
添加 animated-vector-drawable
和 mediarouter libs
解决了该问题。
compile 'com.google.android.gms:play-services:10.2.4'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:animated-vector-drawable:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
我有这个:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.firebase:firebase-firestore:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation'com.facebook.android:facebook-login:[4,5)'
implementation 'com.twitter.sdk.android:twitter:3.1.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation project(':vehiclesapi')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
https://i.stack.imgur.com/qAuHL.png
解决方案很简单——主要依赖项都是正确的,所以剩下的就是——任何第三方依赖项。一一删除,直到找到罪魁祸首,原来是facebook!它使用 27.0.2 版的 android 支持库。我尝试添加 cardview 版本 27.1.1 但这也不起作用,解决方案仍然很简单。
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.firebase:firebase-firestore:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation('com.facebook.android:facebook-login:[4,5)'){
// contains com.android.support:v7:27.0.2, included required com.android.support.*:27.1.1 modules
exclude group: 'com.android.support'
}
implementation 'com.android.support:cardview-v7:27.1.1' // to replace facebook sdk's cardview-v7:27.0.2.
implementation 'com.twitter.sdk.android:twitter:3.1.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation project(':vehiclesapi')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
升级到android studio 2.3后我用这两个来解决我的问题
compile 'com.android.support:animated-vector-drawable:25.0.0'
compile 'com.android.support:mediarouter-v7:25.0.0'
我之前遇到过同样的问题,我得到了解决方案。
我刚刚添加了具有另一个版本但与我的 support:appcompat
版本相同的库。
例如,对于您的错误:
所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 25.1.1、24.0.0。示例包括 com.android.support:animated-vector-drawable:25.1.1 和 com.android.support:mediarouter-v7:24.0.0
*解决方案是像这样编译这些库的版本:
compile 'com.android.support:mediarouter-v7:25.1.1'
- 如果另一个库有同样的问题并且有另一个版本,只需使用您的 support:appcompat
版本编译它
这解决了我的问题,我希望它能解决你的问题。
最好的祝愿 :)
在搜索和组合答案后,这个问题的 2018 版本对我有用:
1)在导航选项卡上将其更改为项目视图
2) 导航到 [YourProjectName]/.idea/libraries/
3) 删除所有以 Gradle__com_android_support_[libraryName] 开头的文件
例如:Gradle__com_android_support_animated_vector_drawable_26_0_0.xml
4) 在您的 gradle 文件中定义一个变量并使用它来替换版本号,如 ${variableName}
定义变量:
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}"
}
使用新版本的 android studio 3.x 非常简单。
只需复制小于当前版本的版本,并使用与当前版本相同的版本号显式添加它。
例子
找到版本 27.1.1、27.1.0。示例包括 com.android.support:animated-vector-drawable:27.1.1 和 com.android.support:exifinterface:27.1.0
只需复制版本 com.android.support:exifinterface:27.1.0
并将其更改为 com.android.support:exifinterface:27.1.1
,使其与您正在使用的当前版本相同,并将其添加到您的 gradle 依赖项中,如下所示。
implementation 'com.android.support:exifinterface:27.1.1'
注意:完成后不要忘记单击编辑器顶部的立即同步。
升级到 android studio 3.4 和 sdk 版本到 28.0.0 后,我遇到了这个问题。应用以下依赖项为我解决了这个问题。
implementation 'com.android.support:exifinterface:28.0.0'
在 2018 年更新此错误从项目结构添加实现
implementation 'com.android.support:support-v13:28.0.0'
在项目模式下--> 外部库在那里您可以找到您的问题,在我的情况下,我使用的是版本 28 和外部库,我找到了 com.android.support:support-media-compat-26.0.0
,这是错误。
实施 support v13
后,它正在工作
您已定义任何其他依赖项以使用版本 24.0.0
而不是 25.1.1
进行编译。请将所有依赖项版本设置为与 25.1.1
相同。
我必须在 gradle 中添加以下行以消除错误
compile 'com.android.support:animated-vector-drawable:25.2.0'
compile 'com.android.support:preference-v7:25.2.0'
compile 'com.android.support:customtabs:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
我运行了 ./gradlew tasks --all 并检查了与目标版本(25.3.1)不同版本的依赖项。你会得到这样的东西:
app:prepareComAndroidSupportAnimatedVectorDrawable2531Library - Prepare com.android.support:animated-vector-drawable:25.3.1
app:prepareComAndroidSupportAppcompatV72531Library - Prepare com.android.support:appcompat-v7:25.3.1
app:prepareComAndroidSupportCardviewV72531Library - Prepare com.android.support:cardview-v7:25.3.1
app:prepareComAndroidSupportCustomtabs2531Library - Prepare com.android.support:customtabs:25.3.1
app:prepareComAndroidSupportDesign2531Library - Prepare com.android.support:design:25.3.1
app:prepareComAndroidSupportMediarouterV72531Library - Prepare com.android.support:mediarouter-v7:25.3.1
app:prepareComAndroidSupportPaletteV72531Library - Prepare com.android.support:palette-v7:25.3.1
app:prepareComAndroidSupportRecyclerviewV72531Library - Prepare com.android.support:recyclerview-v7:25.3.1
app:prepareComAndroidSupportSupportCompat2531Library - Prepare com.android.support:support-compat:25.3.1
app:prepareComAndroidSupportSupportCoreUi2531Library - Prepare com.android.support:support-core-ui:25.3.1
app:prepareComAndroidSupportSupportCoreUtils2531Library - Prepare com.android.support:support-core-utils:25.3.1
app:prepareComAndroidSupportSupportFragment2531Library - Prepare com.android.support:support-fragment:25.3.1
app:prepareComAndroidSupportSupportMediaCompat2531Library - Prepare com.android.support:support-media-compat:25.3.1
app:prepareComAndroidSupportSupportV42531Library - Prepare com.android.support:support-v4:25.3.1
app:prepareComAndroidSupportSupportVectorDrawable2531Library - Prepare com.android.support:support-vector-drawable:25.3.1
app:prepareComAndroidSupportTransition2531Library - Prepare com.android.support:transition:25.3.1
app:prepareComAndroidVolleyVolley100Library - Prepare com.android.volley:volley:1.0.0
app:prepareComCrashlyticsSdkAndroidAnswers1312Library - Prepare com.crashlytics.sdk.android:answers:1.3.12
app:prepareComCrashlyticsSdkAndroidBeta124Library - Prepare com.crashlytics.sdk.android:beta:1.2.4
app:prepareComCrashlyticsSdkAndroidCrashlytics267Library - Prepare com.crashlytics.sdk.android:crashlytics:2.6.7
app:prepareComCrashlyticsSdkAndroidCrashlyticsCore2316Library - Prepare com.crashlytics.sdk.android:crashlytics-core:2.3.16
app:prepareComFacebookAndroidFacebookAndroidSdk4161Library - Prepare com.facebook.android:facebook-android-sdk:4.16.1
app:prepareComGoogleAndroidGmsPlayServicesAnalytics1026Library - Prepare com.google.android.gms:play-services-analytics:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl1026Library - Prepare com.google.android.gms:play-services-analytics-impl:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesAuth1026Library - Prepare com.google.android.gms:play-services-auth:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesAuthBase1026Library - Prepare com.google.android.gms:play-services-auth-base:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesBase1026Library - Prepare com.google.android.gms:play-services-base:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesBasement1026Library - Prepare com.google.android.gms:play-services-basement:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesCast1026Library - Prepare com.google.android.gms:play-services-cast:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesLocation1026Library - Prepare com.google.android.gms:play-services-location:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesMaps1026Library - Prepare com.google.android.gms:play-services-maps:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesTagmanagerV4Impl1026Library - Prepare com.google.android.gms:play-services-tagmanager-v4-impl:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesTasks1026Library - Prepare com.google.android.gms:play-services-tasks:10.2.6
app:prepareComGoogleFirebaseFirebaseAnalytics1026Library - Prepare com.google.firebase:firebase-analytics:10.2.6
app:prepareComGoogleFirebaseFirebaseAnalyticsImpl1026Library - Prepare com.google.firebase:firebase-analytics-impl:10.2.6
app:prepareComGoogleFirebaseFirebaseAppindexing1024Library - Prepare com.google.firebase:firebase-appindexing:10.2.4
app:prepareComGoogleFirebaseFirebaseCommon1026Library - Prepare com.google.firebase:firebase-common:10.2.6
app:prepareComGoogleFirebaseFirebaseCore1026Library - Prepare com.google.firebase:firebase-core:10.2.6
app:prepareComGoogleFirebaseFirebaseIid1026Library - Prepare com.google.firebase:firebase-iid:10.2.6
app:prepareComGoogleFirebaseFirebaseMessaging1026Library - Prepare com.google.firebase:firebase-messaging:10.2.6
app:prepareComMindorksPlaceholderview027Library - Prepare com.mindorks:placeholderview:0.2.7
app:prepareDebugAndroidTestDependencies
app:prepareDebugDependencies
app:prepareDebugUnitTestDependencies
app:prepareInfoHoang8fAndroidSegmented105Library - Prepare info.hoang8f:android-segmented:1.0.5
app:prepareIoFabricSdkAndroidFabric1316Library - Prepare io.fabric.sdk.android:fabric:1.3.16
app:prepareNoNordicsemiAndroidLog211Library - Prepare no.nordicsemi.android:log:2.1.1
app:prepareNoNordicsemiAndroidSupportV18Scanner100Library - Prepare no.nordicsemi.android.support.v18:scanner:1.0.0
在这种情况下,我的目标是 25.3.1,并且在运行此命令时有一些针对不同版本的依赖项。诀窍是识别此列表中针对以前版本的依赖项,并通过在 Gradle 中导入最新版本的依赖项来覆盖它。
我有同样的问题,但我通过添加这三行解决了这个问题
implementation 'com.android.support:design:27.1.1'
implementation "com.android.support:customtabs:27.1.1"
implementation 'com.android.support:mediarouter-v7:27.1.1'
现在一切都完美无缺
这是我修复此警告的流程
构建.gradle
android {
compileSdkVersion ... // must same version (ex: 26)
...
}
dependencies {
...
compile 'any com.android.support... library' // must same version (ex: 26.0.1)
compile 'any com.android.support... library' // must same version (ex: 26.0.1)
...
compile ('a library B which don't use 'com.android.support...' OR use SAME version of 'com.android.support'){
// do nothing
}
...
compile ('a library C which use DIFFERENT 'com.android.support...' (ex:27.0.1) {
// By default, if use don't do anything here your app will choose the higher com.android.support... for whole project (in this case it is 27.0.1)
// If you want to use 26.0.1 use
exclude group: 'com.android.support', module: '...' (ex module: 'appcompat-v7')
exclude group: 'com.android.support', module: 'another module'
...
// If you want to use 27.0.1 do
Upgrade `compileSdkVersion` and all 'com.android.support' to 27.0.1.
(It may be a good solution because the best practice is always use latest `compileSdkVersion`.
However, use 26 or 27 is base on you for example higher library may have bug)
}
}
要查看/验证您应用中所有库的 dependencies
打开终端并运行 ./gradlew app:dependencies
要在您的应用程序中查看特定库的 dependencies
,请按照此处的教程进行操作:- How to exclude dependencies of a particular dependency in Gradle
希望有帮助
打开项目的外部库,您会看到一些库仍在使用以前的版本,尽管您没有提到这些库,所以我的建议是使用特定的库版本来解决您的问题。
我刚刚将我的 Android 支持存储库更新为(修订版:44.0.0);然后将 Android SDK 工具和模拟器从 sdk manager> SDK tools 升级到最新版本 25.3.1 它解决了我的问题。
不定期副业成功案例分享
com.google.android.gms:play-services:10.2.0
支持 SDK 14 及以上版本,如果您想使用 SDK 14 以下版本,您需要使用 stackoverflow.com/a/42315590/6248491 中提到的版本10.0.1
examples include
文本显示的是您自己项目中的实际示例,而不是问题类型的模糊一般示例,这可能会有所帮助。从第二项中获取库,并使用第一项中的版本号实现它。