我正在尝试制作一个使用谷歌地图 API 的应用程序。
但是库方面似乎存在错误,不兼容。
它说
'Found versions 28.0.0 and 26.1.0 examples including com.android.support:animated_vector_drawable:28.0.0 and com.android.support:support-media-compact:26.1.0
这会对调用 R.id 产生影响吗?
我尝试过清理和重建,以及无效的缓存重置。 我尝试将文件添加为依赖项版本 28.0.0,但收到 2 个错误:
Failed to resolve: com.android.support:support-media-compact:28.0.0 Failed to resolve: com.android
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-media-compact:28.0.0'
implementation 'com.android.support:animated_vector_drawable:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-location:16.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'
}
我本以为重写版本可以解决问题,但“com.android.support:appcompat-v7:28.0.0”仍然带有红色下划线。
最佳答案
使用 Gradle View 插件 http://plugins.jetbrains.com/plugin/7150-gradle-view ,我确定问题是 play-services-location:16.0.0 依赖于 com.android.support:support-media-compat:26.1.0。这里描述了我发现的一种消除警告的技术:https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html
这导致我将其添加到我的 gradle 文件中:
implementation("com.android.support:appcompat-v7:28.0.0") {
force = true
}
关于java - Build Gradle 依赖项中的库版本 28 和 26.1 不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54575479/