All the AndroidX versions different from the compile

后端 未结 5 820
轮回少年
轮回少年 2021-01-12 14:30

I\'ve migrated my project to AndroidX cause i was having some errors, but now i\'m receiving a loop of errors that the androidX class has a different version from the compil

相关标签:
5条回答
  • 2021-01-12 14:32

    If the problem persists, you might want to upgrade the gradle version in android/build.grandle

    Change:

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
    

    To:

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'//latest version
    }
    

    You should also update your Kotlin version.

    0 讨论(0)
  • 2021-01-12 14:39

    I've had similar issue, just solved it using this inside app/build.gradle

    configurations.all {
        resolutionStrategy {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'androidx.core') {
                    details.useVersion "1.0.1"
                }
                if (details.requested.group == 'androidx.lifecycle') {
                    details.useVersion "2.0.0"
                }
                if (details.requested.group == 'androidx.versionedparcelable') {
                    details.useVersion "1.0.0"
                }
                if (details.requested.group == 'androidx.fragment') {
                    details.useVersion "1.0.0"
                }
                if (details.requested.group == 'androidx.appcompat') {
                    details.useVersion "1.0.1"
                }
            }
        }
    }
    
    0 讨论(0)
  • 2021-01-12 14:43

    Changing my com.android.tools.build:gradle to version 3.3.1 fixed the issue for me

    0 讨论(0)
  • 2021-01-12 14:52

    I've resolved my error migrating my project to androidX in gradle.properties, and by Refactor => Migrate to AndroidX, and adding this code to my app/build.gradle:

    configurations {
        all*.exclude group: 'com.google.guava', module: 'listenablefuture'
    }
    
    0 讨论(0)
  • 2021-01-12 14:52

    I pasted this.../android/build.gradle (not .../android/app/build.grade) and that made the problem out:

    subprojects {
        project.configurations.all {
        resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'androidx.core' &&
               !details.requested.name.contains('androidx')) {
            details.useVersion "1.0.1"
                }
        }
        }    
    }
    
    0 讨论(0)
提交回复
热议问题