更新到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'
}
花了大约5个小时后,这个解决方案对我有效。。
如果您还没有:
xmlns:tools="http://schemas.android.com/tools"
例子:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.winanainc"
android:versionCode="3"
android:versionName="1.2"
xmlns:tools="http://schemas.android.com/tools">
然后在应用程序中添加这个元标记以覆盖构建工具版本,在本例中,我选择了25.3.1版本
<application>
...
..
<meta-data
tools:replace="android:value"
android:name="android.support.VERSION"
android:value="25.3.1" />
</application>
A) 运行渐变相关性或/gradlew相关性
B) 查看您的树,找出您的哪个依赖项正在为您无法控制的依赖项指定不同的支持库版本。
我没有意识到,如果您自己的代码完全不使用依赖项,则还会显示此警告。在我的例子中,Facebook指定了一些我没有使用的支持库,你可以在下面看到,大多数依赖项都被我自己的25.2.0规范覆盖了,用->X.X.X(*)符号表示。卡视图和自定义选项卡库没有被任何人覆盖,所以我需要自己为这些库请求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:animatedvector-drawable:25.1.1和com.android.support:mediarouter-v7:24.0.0
…如果为较低版本添加一些grep高亮显示,这会更容易,因为gradle依赖关系可能非常冗长:
./gradlew dependencies | grep --color -E 'com.android.support:mediarouter-v7|$'
我的项目中有这些依赖项:
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.firebase:firebase-database:17.0.0'
implementation 'com.google.firebase:firebase-storage:17.0.0'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation 'com.firebaseui:firebase-ui-storage:0.6.0'
到目前为止,似乎没有什么问题,但我得到了这样的信息:
找到版本28.0.0、23.4.0。示例包括com.android.support:动画矢量可绘制:28.0.0和支持:palette-v7:23.4。
然后我做了:
$ ./gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath >> dep.txt
在文件中,我搜索了调色板,发现它被firebase存储所使用:
\--- com.firebaseui:firebase-ui-storage:0.6.0
+--- com.android.support:appcompat-v7:23.4.0 -> 28.0.0 (*)
+--- com.android.support:palette-v7:23.4.0
添加后:
implementation 'com.android.support:palette-v7:28.0.0'
似乎已解决,没有更多错误。
//干杯