7

Android dependency 'com.android.support:support-media-compat' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution

I have added List of plugins in my flutter app

dependencies:
  flutter:
    sdk: flutter
  connectivity:
  rxdart:
  validate: ^1.7.0
  image_picker: ^0.4.10
  shared_preferences: "^0.4.2"
  firebase_auth: ^0.6.2+1
  google_sign_in:

Dart & Flutter version : Dart 2.1.0-dev.3.1.flutter-760a9690c2

This is my android app - gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 27

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.standardappstructure"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'

Destribution Gradle version :

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

Project level : gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

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

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

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

If I am changing gradle classpath to

 classpath 'com.android.tools.build:gradle:3.2.1'

Its showing me

Android dependency 'android.arch.lifecycle:runtime' has different version for the compile (1.0.0) and runtime (1.1.0) classpath. You should manually set the same version via DependencyResolution

2
  • What is your buildToolsVersion? Can't find a declaration of it in the app gradle. Commented Nov 5, 2018 at 15:53
  • As default i didn't added buildToolsVersion but i tried with buildToolsVersion '27.0.3' and '27.1.1' but still same error. Commented Nov 5, 2018 at 16:10

3 Answers 3

2

You can solve this error with below code change in android>build.gradle

If your project config with kotlin then

   ext.kotlin_version = '1.2.71'

     replace with new version

   ext.kotlin_version = '1.3.0'

and

dependencies {classpath 'com.android.tools.build:gradle:3.2.1'}
                    replace with new version
dependencies {classpath 'com.android.tools.build:gradle:3.3.0'}

You probably get your obstacles if your exception is

What went wrong: Execution failed for task ':app:preDebugBuild'. Android dependency 'androidx.exifinterface:exifinterface' 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

Sign up to request clarification or add additional context in comments.

1 Comment

For a newer version of com.android.tools.build:gradle check firebase.google.com/docs/android/setup#manually_add_firebase
2

I added implementation("com.android.support:support-v4:latest_version_number") to my build.gradle and it worked.Hope this helps.

1 Comment

I used implementation("com.android.support:support-v4:28.0.0") and it worked thanks ;-)
1
cloud_firestore: ^0.8.2+3
firebase_auth: ^0.6.5
image_picker: 0.4.0

This works for me

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.