我的应用程序使用API19,我在其中一个布局中添加了一个MapView,并添加了谷歌地图实现。现在我从gradle那里得到了一个警告,说我正在混合版本。
以下是警告:
所有的com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本28.0.0-rc02、26.1.0。示例包括com.android.support:animated-vector-drawable:28.0.0-rc02和com.android.support:support-media-compat:26.1.0 more...(Ctrl+F1)
下面是我的gradle依赖项:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
针对'com.android.support:appcompat-v7:28.0.0-rc02'
显示警告。
我不确定在哪里可以找到用于play-services-maps
的正确版本,也不知道如何正确地解决这个问题。我不想将我的最小版本从19降级。
发布于 2018-09-01 15:05:21
将此代码添加到build.gradle (:app)的末尾
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
details.useVersion '26.1.0'
}
}
}
发布于 2018-09-09 20:25:26
建议是这样的:
所有的com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。
这意味着,您必须exclude
26.1.0
并提供28.0.0-rc02
:
implementation "com.android.support:support-media-compat:28.0.0-rc02"
implementation "com.android.support:support-v4:28.0.0-rc02"
implementation ("com.google.android.gms:play-services-maps:15.0.1") {
exclude group: "com.google.android.gms", module: "support-media-compat"
exclude group: "com.android.support", module: "support-v4"
}
可能会有更多的版本冲突,但修复它们的效果是一样的。
发布于 2018-09-03 15:59:14
1.转到文件系统上的project/.idea/libraries文件夹,查看哪些库是不同的。
2.您必须手动将这些具有相同版本的库包含在build.gradle文件中。
3.然后,同步您的项目
在你的案例中:
implementation 'com.android.support:animated-vector-drawable:28.0.0-rc02'
您需要添加依赖项:-
implementation 'com.android.support:support-media-compat:28.0.0-rc02'
https://stackoverflow.com/questions/52125713
复制相似问题