1

I'm getting error(s) while compiling due to AndroidX incompatibility:

Android dependency 'androidx.vectordrawable:vectordrawable' has different version for the compile (1.0.0) and runtime (1.0.1) classpath. You should manually set the same version via DependencyResolution

following -> this post <- I've added some code to build.gradle

allprojects {

configurations.all {
    resolutionStrategy.force"androidx.vectordrawable:vectordrawable:1.0.0",
}
repositories {
    google()
    jcenter()
}

next run gave me this other error

Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.1) classpath. You should manually set the same version via DependencyResolution

I tried to add this

"androidx.vectordrawable:vectordrawable:1.0.0","androidx.core:core:1.0.0",

but I'm probably doing it wrong, since I get the classical "unexpected bla bla bla"

any suggestion?

thanks in advance

[edit] i've tried this old trick as well, but didn't work (also downgrading the packages as required HERE)

rootProject.allprojects {
    project.configurations.all {
        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"
            }
        }
    }
}

now returns a different error

Android dependency 'androidx.appcompat:appcompat' has different version for the compile (1.0.0) and runtime (1.0.2) classpath. You should manually set the same version via DependencyResolution

Francesco Iapicca
  • 2,618
  • 5
  • 40
  • 85
  • if i see correctly androidX updated a bunch of stuff 2 days ago (5th june '19) probably that's why flutter is behind :/ https://developer.android.com/jetpack/androidx/versions – Francesco Iapicca Jun 07 '19 at 13:28

3 Answers3

6
  1. In android/gradle/wrapper/gradle-wrapper.properties change the line starting with distributionUrl like this: distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip

2.In android/build.gradle, replace:

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

by

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

3.In android/gradle.properties, append

android.enableJetifier=true
android.useAndroidX=true

4.In android/app/build.gradle:

Under android {, make sure compileSdkVersion and targetSdkVersion are at least 28.

5.Replace all deprecated libraries with the AndroidX equivalents. For instance, if you’re using the default .gradle files make the following changes:

In android/app/build.gradle

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

by

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Finally, under dependencies replace

androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

by

androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
Javier González
  • 1,999
  • 17
  • 18
1

You need to use this indacation with the latest version of... :)

1) In android/gradle/wrapper/gradle-wrapper.properties

Replace the line starting with distributionUrl by the latest gradle :

> distributionUrl = https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

2) In

android/build.gradle

you need to replace:

> dependencies {
>     classpath 'com.android.tools.build:**gradle:x.x.x**' }

with

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

3) In android/gradle.properties paste this

android.enableJetifier=true android.useAndroidX=true

4) In android/app/build.gradle: make sure compileSdkVersion and targetSdkVersion are at least 28``

The most imrportant is here: In android/app/build.gradle: replace

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

with `

> testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

`

replace

> androidTestImplementation 'com.android.support.test:runner:x.x.x'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:x.x.x'

with

> androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
M E S A B O
  • 783
  • 1
  • 11
  • 15
  • I have the same problem, I already followed your instructions and I even tried with others but the error continues, I don't know what to change, I don't know if it affects that I have the most updated version of flutter. `Execution failed for task ':simple_permissions:verifyReleaseResources` @Messou – Palomita Yañez Quiroz Aug 04 '20 at 17:33
0

Always make sure the newly added dependencies match the version of your gradle, you may need to either upgrade or downgrade the dependencies to match your gradle version, but most importantly, its recommended to use the latest gradle version and match this with latest plugin dependencies to avoid these errors.