迁移到 AndroidX
Migrating to AndroidX
我将我的 Android Studio 升级到 3.2,现在我想使用 Redactor
->Migrate to AndroidX
自动迁移到 AndroidX,现在出现此错误:
Android dependency 'androidx.media:media' has different version for
the compile (1.0.0-rc01) and runtime (1.0.0) classpath. You should
manually set the same version via DependencyResolution
尝试手动修复。
只需将依赖更改为:
androidx.media:media:1.0.0
并在 类
中更改 imports
可能您的依赖项之一使用了 androidx.media:media:1.0.0-rc1
。您应该使用 Gradle's Dependency Resolution Strategy 强制所有依赖项使用相同的版本。
尝试在您的应用级别 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
...
}
最后我将 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'
...
希望对您有所帮助。
我将我的 Android Studio 升级到 3.2,现在我想使用 Redactor
->Migrate to AndroidX
自动迁移到 AndroidX,现在出现此错误:
Android dependency 'androidx.media:media' has different version for the compile (1.0.0-rc01) and runtime (1.0.0) classpath. You should manually set the same version via DependencyResolution
尝试手动修复。
只需将依赖更改为:
androidx.media:media:1.0.0
并在 类
中更改 imports可能您的依赖项之一使用了 androidx.media:media:1.0.0-rc1
。您应该使用 Gradle's Dependency Resolution Strategy 强制所有依赖项使用相同的版本。
尝试在您的应用级别 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
...
}
最后我将 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'
...
希望对您有所帮助。