Android studio play-services-ads:12.0.1 与 appcompat-v7:27.1.0 冲突
Android studio play-services-ads:12.0.1 conflicts with appcompat-v7:27.1.0
我正在使用 google ADS sdk 构建一个应用程序,它工作正常,直到今天我收到更新 Android studio 的通知,同时我还提示我更新 Gradle 到 4.4 和所有支持库版本到 27.1.0.
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.google.android.gms:play-services-ads:12.0.1'
然后我收到 Gradle 错误,指出 Android 依赖项 'com.android.support:support-v4' 具有不同的编译版本 (26.1.0) 和运行时 (27.1.0) 类路径。您应该通过 DependencyResolution
手动设置相同的版本
我搜索了我的代码,没有一个词可以匹配“26.1.0”。我也尝试删除所有 build/gradle 缓存,但仍然无法解决这个问题。所以我使用 gradlew.bat -q dependencies 发现 ADS 库似乎有错误的依赖关系。
这两行很可疑:
+--- com.android.support:support-v4:26.1.0
+--- com.android.support:support-media-compat:26.1.0
与其他依赖项设置相比
+--- project :MyAdsProject
+--- com.android.support:appcompat-v7:27.1.0
| +--- com.android.support:support-annotations:27.1.0
| +--- com.android.support:support-core-utils:27.1.0
| | +--- com.android.support:support-annotations:27.1.0
| | \--- com.android.support:support-compat:27.1.0
| | +--- com.android.support:support-annotations:27.1.0
| | \--- android.arch.lifecycle:runtime:1.1.0
| | +--- android.arch.lifecycle:common:1.1.0
| | \--- android.arch.core:common:1.1.0
| +--- com.android.support:support-fragment:27.1.0
| | +--- com.android.support:support-compat:27.1.0 (*)
| | +--- com.android.support:support-core-ui:27.1.0
| | | +--- com.android.support:support-annotations:27.1.0
| | | +--- com.android.support:support-compat:27.1.0 (*)
| | | \--- com.android.support:support-core-utils:27.1.0 (*)
| | +--- com.android.support:support-core-utils:27.1.0 (*)
| | +--- com.android.support:support-annotations:27.1.0
| | +--- android.arch.lifecycle:livedata-core:1.1.0
| | | +--- android.arch.lifecycle:common:1.1.0
| | | +--- android.arch.core:common:1.1.0
| | | \--- android.arch.core:runtime:1.1.0
| | | \--- android.arch.core:common:1.1.0
| | \--- android.arch.lifecycle:viewmodel:1.1.0
| +--- com.android.support:support-vector-drawable:27.1.0
| | +--- com.android.support:support-annotations:27.1.0
| | \--- com.android.support:support-compat:27.1.0 (*)
| \--- com.android.support:animated-vector-drawable:27.1.0
| +--- com.android.support:support-vector-drawable:27.1.0 (*)
| \--- com.android.support:support-core-ui:27.1.0 (*)
\--- com.google.android.gms:play-services-ads:12.0.1
+--- com.google.android.gms:play-services-ads-lite:12.0.1
| +--- com.google.android.gms:play-services-basement:12.0.1
| | +--- com.android.support:support-v4:26.1.0
| | | +--- com.android.support:support-compat:26.1.0 -> 27.1.0 (*)
| | | +--- com.android.support:support-media-compat:26.1.0
| | | | +--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| | | | \--- com.android.support:support-compat:26.1.0 -> 27.1.0 (*)
| | | +--- com.android.support:support-core-utils:26.1.0 -> 27.1.0 (*)
| | | +--- com.android.support:support-core-ui:26.1.0 -> 27.1.0 (*)
| | | \--- com.android.support:support-fragment:26.1.0 -> 27.1.0 (*)
| | \--- com.google.android.gms:play-services-basement-license:12.0.1
| \--- com.google.android.gms:play-services-ads-lite-license:12.0.1
+--- com.google.android.gms:play-services-basement:12.0.1 (*)
+--- com.google.android.gms:play-services-gass:12.0.1
| +--- com.google.android.gms:play-services-basement:12.0.1 (*)
| \--- com.google.android.gms:play-services-gass-license:12.0.1
\--- com.google.android.gms:play-services-ads-license:12.0.1
有人知道如何摆脱这个吗? ADS 12.0.1 目前已经是最新版本。
在您的应用级别 build.gradle
:
android {
configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:27.1.1'
}
}
这将告诉您的 gradle 配置强制选择并应用 support-v4:27.1.1
它导入的任何地方!
希望对您有所帮助!
我可以通过在我的依赖项中添加这个来解决这个问题
implementation 'com.android.support:support-v4:28.0.0'
或
在您的应用中添加此代码gradle
android {
configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
}
}
我正在使用 google ADS sdk 构建一个应用程序,它工作正常,直到今天我收到更新 Android studio 的通知,同时我还提示我更新 Gradle 到 4.4 和所有支持库版本到 27.1.0.
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.google.android.gms:play-services-ads:12.0.1'
然后我收到 Gradle 错误,指出 Android 依赖项 'com.android.support:support-v4' 具有不同的编译版本 (26.1.0) 和运行时 (27.1.0) 类路径。您应该通过 DependencyResolution
手动设置相同的版本我搜索了我的代码,没有一个词可以匹配“26.1.0”。我也尝试删除所有 build/gradle 缓存,但仍然无法解决这个问题。所以我使用 gradlew.bat -q dependencies 发现 ADS 库似乎有错误的依赖关系。
这两行很可疑:
+--- com.android.support:support-v4:26.1.0
+--- com.android.support:support-media-compat:26.1.0
与其他依赖项设置相比
+--- project :MyAdsProject
+--- com.android.support:appcompat-v7:27.1.0
| +--- com.android.support:support-annotations:27.1.0
| +--- com.android.support:support-core-utils:27.1.0
| | +--- com.android.support:support-annotations:27.1.0
| | \--- com.android.support:support-compat:27.1.0
| | +--- com.android.support:support-annotations:27.1.0
| | \--- android.arch.lifecycle:runtime:1.1.0
| | +--- android.arch.lifecycle:common:1.1.0
| | \--- android.arch.core:common:1.1.0
| +--- com.android.support:support-fragment:27.1.0
| | +--- com.android.support:support-compat:27.1.0 (*)
| | +--- com.android.support:support-core-ui:27.1.0
| | | +--- com.android.support:support-annotations:27.1.0
| | | +--- com.android.support:support-compat:27.1.0 (*)
| | | \--- com.android.support:support-core-utils:27.1.0 (*)
| | +--- com.android.support:support-core-utils:27.1.0 (*)
| | +--- com.android.support:support-annotations:27.1.0
| | +--- android.arch.lifecycle:livedata-core:1.1.0
| | | +--- android.arch.lifecycle:common:1.1.0
| | | +--- android.arch.core:common:1.1.0
| | | \--- android.arch.core:runtime:1.1.0
| | | \--- android.arch.core:common:1.1.0
| | \--- android.arch.lifecycle:viewmodel:1.1.0
| +--- com.android.support:support-vector-drawable:27.1.0
| | +--- com.android.support:support-annotations:27.1.0
| | \--- com.android.support:support-compat:27.1.0 (*)
| \--- com.android.support:animated-vector-drawable:27.1.0
| +--- com.android.support:support-vector-drawable:27.1.0 (*)
| \--- com.android.support:support-core-ui:27.1.0 (*)
\--- com.google.android.gms:play-services-ads:12.0.1
+--- com.google.android.gms:play-services-ads-lite:12.0.1
| +--- com.google.android.gms:play-services-basement:12.0.1
| | +--- com.android.support:support-v4:26.1.0
| | | +--- com.android.support:support-compat:26.1.0 -> 27.1.0 (*)
| | | +--- com.android.support:support-media-compat:26.1.0
| | | | +--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| | | | \--- com.android.support:support-compat:26.1.0 -> 27.1.0 (*)
| | | +--- com.android.support:support-core-utils:26.1.0 -> 27.1.0 (*)
| | | +--- com.android.support:support-core-ui:26.1.0 -> 27.1.0 (*)
| | | \--- com.android.support:support-fragment:26.1.0 -> 27.1.0 (*)
| | \--- com.google.android.gms:play-services-basement-license:12.0.1
| \--- com.google.android.gms:play-services-ads-lite-license:12.0.1
+--- com.google.android.gms:play-services-basement:12.0.1 (*)
+--- com.google.android.gms:play-services-gass:12.0.1
| +--- com.google.android.gms:play-services-basement:12.0.1 (*)
| \--- com.google.android.gms:play-services-gass-license:12.0.1
\--- com.google.android.gms:play-services-ads-license:12.0.1
有人知道如何摆脱这个吗? ADS 12.0.1 目前已经是最新版本。
在您的应用级别 build.gradle
:
android {
configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:27.1.1'
}
}
这将告诉您的 gradle 配置强制选择并应用 support-v4:27.1.1
它导入的任何地方!
希望对您有所帮助!
我可以通过在我的依赖项中添加这个来解决这个问题
implementation 'com.android.support:support-v4:28.0.0'
或
在您的应用中添加此代码gradle
android {
configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
}
}