When I modify my build.gradle files to use the Firebase plugin, It shows me an error on implementation 'com.android.support:appcompat-v7:28.0.0'
I have already added the google-services.json file into my Android app module root directory.
My error: Issue ID= Gradle compatible
All com.android.support libraries must have the exact same version specification...Found versions 28.0.0,26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:26.1.0
I have tried to comment it out:
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
But also it didn't work it cant communicate with firebase servers
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.android.tinder"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation 'com.lorentzos.swipecards:library:1.0.9'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.1.0'
}
apply plugin: 'com.google.gms.google-services'
My build.gradle code(Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I just expect to be able to connect my Firebase to my android app
The solution is:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0' // NEED TO ADD
implementation 'com.android.support:support-v4:28.0.0' //NEED TO ADD
implementation 'com.google.firebase:firebase-storage:16.0.5'
I solved my problem by changing the version of Fire-base
and classpath
dependencies.
The latest version of dependencies conflicted with implementation 'com.android.support:appcompat-v7:28.0.0'
in App level build.gradle
.
My changes are given below
implementation 'com.google.firebase:firebase-core:17.0.1'
to implementation 'com.google.firebase:firebase-core:16.0.8'
in App level build.gradle
file.
classpath 'com.google.gms:google-services:4.3.0'
to classpath 'com.google.gms:google-services:4.2.0'
in Project level build.gradle
file.
* If you migrate your project to AndroidX, then you will be able to use all the latest dependencies without facing this kind of errors *
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.