Question Detail

Android dependency 'android.arch.lifecycle:runtime' has different version for classpath in Flutter

4 years ago Views 2288 Visit Post Reply

I have update my flutter ios pod by exicute below two commands

  1. cd iOS
  2. pod update --verbose

after this i am getting below error in android

 

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'android.arch.lifecycle:runtime' has different version for the compile (1.0.0) and runtime (1.1.0) classpath. You should manually setthe same version via DependencyResolution

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s


Thread Reply

alex levine

- 4 years ago

I was getting the same issue when i integrate Firebase push Notificaiton with my Flutter project dependency 'android.arch.lifecycle:runtime' has different version for classpath in Flutter 

i resolve it by change some project configurations in the android > build.gradle >

 

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}
// add bold code in your in your build.gradle file
subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.1.0"
            }
        }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}