-1

Okay guys, hello. I'm new here (this is my first post, so if I have done anything wrong please forgive me and let me know! ). Could you please help me with this problem. I'm really stuck. check the red underlined line on Screenshot below (dependencies) .

Android Error:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-rc01, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-rc01 and com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1) Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

Screenshot: https://i.stack.imgur.com/YLeCT.jpg

I have tried the following:

All com.android.support libraries must use the exact same version specification

All com.android.support libraries must use the exact same version specification (mixing version can lead to runtime crashes)

build.gradle:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-core:16.0.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso core:3.0.2' }
Zoe
  • 27,060
  • 21
  • 118
  • 148
  • convert your project into androidx and then check. if still not work then post your both gradle (project level and app level) – android May 02 '19 at 04:15

1 Answers1

0

Hey welcome and congrats with a detailed question!

You're using some dependencies and these dependencies might have transitive dependencies as well. This means that you're compiling your code against some API and your dependencies already compiled against some API (and probably different slightly or more). So gradle is confused which version of that dependency to take - yours or the transitive from the third party. If it would be automatic it might lead to a runtime crash when you or your dependency will try to call a method or class that was changed or doesn't exist in one of the versions of that shared dependency.

You can troubleshoot your dependencies with gradle:

./gradlew dependencies

or even better:

./gradlew dependencies | grep <name of the conflicting dependency> -B 20 -A 20

The usual way in the Android world of resolving it is to force a specific version of this dependency (usually the newest):

  configurations.all {
    resolutionStrategy {
      force <exact dependency version>
    }
  }

Two addition:

Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114