迁移到AndroidX
我将我的Android Studio升级到3.2,现在我想使用from迁移到AndroidX,android,androidx,Android,Androidx,我将我的Android Studio升级到3.2,现在我想使用fromRedactor->migrate to AndroidX自动迁移到AndroidX,现在它出现以下错误: Android依赖项“androidx.media:media”的版本不同 编译(1.0.0-rc01)和运行时(1.0.0)类路径。你应该 通过DependencyResolution手动设置相同版本 尝试手动修复它 只需将依赖项更改为: 媒体:媒体:1.0.0 更改导入类中的可能是您的一个依赖项使用了androidx
Redactor
->migrate to AndroidX
自动迁移到AndroidX,现在它出现以下错误:
Android依赖项“androidx.media:media”的版本不同
编译(1.0.0-rc01)和运行时(1.0.0)类路径。你应该
通过DependencyResolution手动设置相同版本
尝试手动修复它 只需将依赖项更改为: 媒体:媒体:1.0.0
更改导入类中的可能是您的一个依赖项使用了
androidx.media:media:1.0.0-rc1
。您应该使用强制所有依赖项使用同一版本。尝试在您的应用程序级别
build.gradle
中添加以下代码,它应该可以工作。大概是这样的:
android {
compileSdkVersion 28
defaultConfig {
// Your code
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
// Your build types if any
}
configurations.all {
resolutionStrategy {
force 'androidx.media:media:1.0.0'
}
}
}
您还可以使用此命令检测哪些依赖项使用了androidx.media:media:
./gradlew :app:dependencies
重构将旧导入更改为以下内容:
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
如果不打算使用旧版依赖项,则可能需要使用以下选项:
implementation 'androidx.appcompat:appcompat:1.0.0'
如果您根本不使用介质,这也将消除问题…我也遇到了同样的问题,我通过使用以下方法解决了此问题:
buildscript {
ext{
kotlin_version = '1.3.0' // Old 1.2.71
...
}
Endly i将gradle版本从3.2.1更改为3.3.1:
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:4.0.1'
...
我希望这会有所帮助。我根本没有使用“androidx.media:media”,我对这个依赖项“androidx.legacy:legacy-support-v4”有相同的问题,并将它们都添加到“resolutionStrategy”中,解决了我的问题。我面临着同样的问题。在应用程序级或项目级build.gradle中,我们应该在哪里添加此策略?@HardikTrivedi您应该将其添加到配置根目录下的应用程序级gradle文件中。我会在
依赖项
声明之前说。删除实现'androidx.legacy:legacy-support-v4:1.0.0'
对我来说很有效。