【发布时间】:2020-01-27 04:16:58
【问题描述】:
为了将目标 SDK 更改为 28,我在 build.gradle 中做了以下操作:
android {
compileSdkVersion 28
defaultConfig {
targetSdkVersion 28
...
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0' //-- line with error
implementation 'com.android.support:design:28.0.0' //-- line with error
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation "com.google.code.gson:gson:2.8.2"
implementation files('libs/commons-io-2.4.jar')
implementation files('libs/WebtrendsAndroidClientLib.jar')
// Urban Airship -- Start
api 'com.urbanairship.android:urbanairship-sdk:9.0.0'
// Recommended for in-app messages
implementation 'com.android.support:cardview-v7:28.0.0' //-- line with error
// We need to add these to force Urban AirShip and Google play services to use latest version.
implementation 'com.android.support:animated-vector-drawable:28.0.0' //-- line with error
implementation 'com.android.support:mediarouter-v7:28.0.0' //-- line with error
implementation "com.google.android.gms:play-services:11.8.0"
// Urban Airship -- End
//-- third party lib
implementation 'com.github.barteksc:android-pdf-viewer:2.4.0'
implementation 'com.sothree.slidinguppanel:library:3.3.0'
implementation 'com.google.maps.android:android-maps-utils:0.5+'
//api 'at.favre.lib', name: 'bytes', version: '0.2.0'
api 'at.favre.lib:bytes:0.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
但在 Android Studio IDE 中,它显示行错误:
com.android.support:appcompat-v7:28.0.0
和描述:
如果我评论这一行,下一行“28.0.0”也会有同样的错误。所以看起来“28.0.0”的那些都没有生效。
我做错了什么?
不是
更新了“依赖项”中的全部内容,并标记了每个将出现错误的实现。每个错误都与图片中的描述完全相同
顺便说一句,尝试了以下网址中的解决方案:All com.android.support libraries must use the exact same version specification,但它对我根本不起作用,并且发生了同样的错误。
** Note on Note **:网址中的解决方案:All com.android.support libraries must use the exact same version specification 确实有效。您需要“同步”项目。
谢谢,
肖恩
【问题讨论】:
-
您可能依赖于本身依赖于
support-v4:25.2.0的东西。你检查过你的传递依赖吗? -
例如,如果您依赖一个生成四舍五入的
ImageViews 或类似的开源库,则该库本身可能依赖于旧版本的支持库。跨度> -
@Ben,如何检查传递依赖?我更新了“依赖项”的全部内容。谢谢。
标签: android target android-api-levels