0

I have upgraded to Android Studio 3.1 and Gradle 4.4 and sdk tools 27.

Now I’m getting the following error:

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

I dont even know where to start to find the fix for this. Please help.

BrightArk
  • 1
  • 1
  • 1
  • Please edit your question and post your entire `build.gradle` file that has this dependency. Something is unusual in your `dependencies` closure. – CommonsWare Apr 08 '18 at 20:43
  • The reason is, as far as I have encountered, that appcompat is also included in one of your dependencies, and it is different from appcompat you depend on. You can try solution listed here to solve the issue, or you can try to identify the problematic dependency and exclude the appcompat from it - https://github.com/flutter/flutter/issues/14020 – Anhayt Ananun Apr 08 '18 at 22:23
  • Possible duplicate of [Android dependency has different version for the compile and runtime](https://stackoverflow.com/questions/44653261/android-dependency-has-different-version-for-the-compile-and-runtime) – Anhayt Ananun Apr 08 '18 at 22:36

1 Answers1

0

You should be able to see exactly which dependency is pulling in the odd version as a transitive dependency by running the correct gradle -q dependencies command for your project as described here:

[https://docs.gradle.org/current/userguide/userguide_single.html#sec:listing_dependencies][1]

Once you track down what's pulling it in, you can add an exclude to that specific dependency in your gradle file with something like:

implementation("XXXXX") {
    exclude group: 'com.android.support', module: 'support-compat'
}

Example :

dependencies {
    implementation('log4j:log4j:1.2.15') {
        exclude group: 'javax.jms', module: 'jms'
        exclude group: 'com.sun.jdmk', module: 'jmxtools'
        exclude group: 'com.sun.jmx', module: 'jmxri'
    }
}
Ramana V V K
  • 1,245
  • 15
  • 24