0

when I try to insert libraries as indicated by firebase, and I try to Sync the project, i get this error:

Error image

This support library should not use a different version (26) than the compileSdkVersion (27) 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).

I tried to follow some guides (https://firebase.google.com/docs/android/setup?authuser=0) and past answers of this problem, but the error persists

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-auth:16.2.1'
    implementation 'com.google.firebase:firebase-database:16.1.0'
    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'
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
AXOPAXO
  • 7
  • 5
  • just do alt+enter and fix it.. if not, give the complete view of build.gradle(app). – Goutham Apr 08 '19 at 17:02
  • Possible duplicate of [All com.android.support libraries must use the exact same version specification](https://stackoverflow.com/questions/42374151/all-com-android-support-libraries-must-use-the-exact-same-version-specification) – Martin Zeitler Apr 08 '19 at 17:08
  • Possible duplicate of [Why do I get "All com.android.support libraries must use the exact same version specification" in Android Studio 3.2.1?](https://stackoverflow.com/questions/53115740/why-do-i-get-all-com-android-support-libraries-must-use-the-exact-same-version) – Faysal Ahmed Apr 08 '19 at 17:13

2 Answers2

1

Make sure that you are using the same API level 27, for 27.1.1 android support, from your app build.gradle:

android {
    compileSdkVersion 27
    defaultConfig {
       .
       minSdkVersion 15
       targetSdkVersion 27
       .
       .
       .
}
.
}

UPDATE

This may be caused by conflicts with the firebase versions. See this question. Try to add this implementations on dependences, to fix this conflicts:

def android_api = "27.1.1"
implementation "com.android.support:appcompat-v7:$android_api"

implementation "com.android.support:animated-vector-drawable:$android_api"
implementation "com.android.support:exifinterface:$android_api"
implementation "com.android.support:cardview-v7:$android_api"
implementation "com.android.support:customtabs:$android_api"
implementation "com.android.support:support-media-compat:$android_api"
implementation "com.android.support:support-v4:$android_api"
Rodrigo Paixão
  • 246
  • 5
  • 12
  • With 15 it doesn't work...by default I have 23( minSdkVersion 23) – AXOPAXO Apr 08 '19 at 17:11
  • Ok, the error has disappeared but now it gives me: failed linking references during building – AXOPAXO Apr 08 '19 at 17:44
  • resource style/Theme.AppCompat.Light.DarkActionBar (aka com.example.gestionaletorneo:style/Theme.AppCompat.Light.DarkActionBar) not found. – AXOPAXO Apr 08 '19 at 17:47
  • Sorry, maybe I wasn't clear, by saying that you need to add, this implementations. But, you need to keep the `implementation "com.android.support:appcompat-v7:$android_api"`. I will update my answer again. – Rodrigo Paixão Apr 08 '19 at 18:00
  • Thank you very much for the help, now the conflict has disappeared – AXOPAXO Apr 09 '19 at 10:13
0

Update:

implementation 'com.android.support:support-media-compat:26.1.0'

to the following:

implementation 'com.android.support:support-media-compat:27.1.1'

So, it can be the same version as appcompat-v7

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
  • Yes, I don't know why it doesn't work by looking at the previous questions – AXOPAXO Apr 08 '19 at 17:24
  • Btw if you sync, you may get that error again but with a different library, then you just have to change the version of the library to 27.1.1 – Peter Haddad Apr 08 '19 at 17:42