Android Google Map and firebase Dependency Issue - android

I am working on maps along with firebase for the very first time and stuck on dependency issue.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 16.0.1.
However following rest of questions on SO(in order to avoid version conflicts) that update
implementation 'com.google.android.gms:play-services-maps:16.0.0'
to
implementation 'com.google.android.gms:play-services-maps:16.0.1'
doesn't work for me.
Similarly, updating
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
to
implementation 'com.google.firebase:firebase-auth:16.0.0'
implementation 'com.google.firebase:firebase-database:16.0.0'
doesn't work either. Both cases given the same error that dependency doesn't exists.
Other than these I have also tried cleaning and rebuilding project but that doesn't work too. Please help me with this issue
BUILD.GRADLE(app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.watersystem.client"
minSdkVersion 21
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 "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-maps:16.0.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'
BUILD.GRADLE(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.30'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
google()
maven { url "https://maven.google.com" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

After few more combinations of dependencies, converting below 3 lines
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
to
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
worked for me.

Related

Unable to resolve dependency firebase and google play service

I am trying to connect my android project to firebase. It was working also properly in starting. I don't know what happened all by sudden i am got series of Unresolved dependencies.
I have done almost all steps which I found over web. Like disable offline work, Invalidate chache/restart. Even when I am creating new project I am facing same problem. Earlier this all things were not happening.
My application gradle code is :
// 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.0.1'
}
}
allprojects {
repositories {
google()
maven { url "http://jcenter.bintray.com"}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle for module
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.aabsys.metasensing"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "2.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'])
//noinspection GradleCompatible
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.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
}
apply plugin: 'com.google.gms.google-services'
Thanks in advance.Please find image
Try adding the following dependency in your code:-
implementation 'com.google.android.gms:play-services:12.0.1'
If it still does not resolve your issue, try updating Google play services and Google repository.
Try to change the class path
classpath 'com.google.gms:google-services:4.2.0'
I solved my issue by reducing google service version to :
classpath 'com.google.gms:google-services:4.0.0'
And removing
implementation 'com.google.firebase:firebase-core:16.0.1'

Problem with the Gradle files. I have already connected the project to Firebase and now I am trying to add Google map

My project is connected to Firebase (Database) and now I am tring to add Google map. When I add one of the dependencies I get an error message while the sync.
It says something about using different version etc.
HELP !!
Description:
After I added this line to the app gradle file:
implementation 'com.google.android.gms:play-services-maps:16.0.0'
I got this error:
The library com.google.android.gms:play-services-base is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
with out the line that I have added everything is fine.
app gradle code:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.rotem.bepart_appproject"
minSdkVersion 23
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(include: ['*.jar'], dir: 'libs')
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.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
**implementation 'com.google.android.gms:play-services-maps:16.0.0'**
}
my project gradle file:
// 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.0.1'
// 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
}
To solve this, please change the following lines of code:
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
**implementation 'com.google.android.gms:play-services-maps:16.0.0'**
to
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
Keeping the same version for all Firebase dependencies is now anti-pattern.

Adding firebase dependency causes gradle sync to fail

I added the firebase database dependency via the Tools->Firebase->Add Real Time Database to your app method, and this causes my gradle sync to fail. I'm guessing either there is a conflict in dependencies (because I have already set up google sign in for my app using firebase and everything is working fine) or the wrong dependency was loaded
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
Module Gradle File:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "nus.is3261.kotlinapp"
minSdkVersion 21
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.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'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.shaishavgandhi:login-buttons:1.0.0'
compile 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
}
apply plugin: 'com.google.gms.google-services'
Project Gradle File:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.70'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.1.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
}
Try to Replace
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
with
implementation 'com.google.firebase:firebase-database:16.0.4'

Dependency collision between play-services-map and firebase

Im trying to add firebase to a project that i already started, But in the build.gradle (app) i am having a dependency collision between play-services-maps and firebase, i looked everywhere and tried changing the version number but still not working.
here is the build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.android.tencho.test"
minSdkVersion 22
targetSdkVersion 26
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:26.1.0'
implementation 'com.google.android.gms:play-services:15.0.1'
// implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.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'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.google.firebase:firebase-core:16.0.0'
// //Firebase Auth
implementation 'com.google.firebase:firebase-auth:16.0.1'
// //FirebaseUI Auth
compile 'com.firebaseui:firebase-ui-auth:3.3.0'
}
apply plugin: 'com.google.gms.google-services'
Build.gradle (project level)
// 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.0.1'
// The google-services plugin has 2 main functions:
// 1) Process the google-services.json file and produce Android resources that can be used in your
// application's code
// 2) Add dependencies for basic libraries required for the services you have enabled. This step requires
// that the apply plugin: 'com.google.gms.google-services' line be at the bottom of your app/build.gradle file
// so that no dependency collisions are introduced.
classpath 'com.google.gms:google-services:4.0.1'
// 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
}
You are using inconsistent version.
Let me tell you simple example.
If you are using google play services 11.8.0, then firebase should also be in same version..
compile 'com.google.android.gms:play-services:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.android.gms:play-services-maps:11.8.0'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
So the main thing to be noted is, you are using inconsistent versions.

Supertypes of the following classes cannot be resolved

I have android app in kotlin which is giving me this error.
Error: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class com.google.firebase.auth.FirebaseAuth, unresolved supertypes: com.google.android.gms.internal.aad
and this
Error:Execution failed for task ':app:compileDebugKotlin'.
Compilation error. See log for more details
this is my app module
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "appname"
minSdkVersion 15
targetSdkVersion 26
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 "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:animated-vector-drawable:26.1.0'
implementation 'com.android.support:mediarouter-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.firebaseui:firebase-ui-database:3.0.0'
//noinspection GradleCompatible,GradleCompatible
implementation 'com.google.android.gms:play-services:11.0.4'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.firebase:firebase-storage:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
and my project gradle is this
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have firebase.auth implementation but still, it's showing me the error.
Updating com.firebaseui:firebase-ui-auth to 3.3.1 fixed it for me. As the older versions (3.1.0 in my case) was not compatible with com.google.firebase:firebase-messaging v15
Updating all the dependencies from the "com.google.android.gms:" group and also the firebase-messaging version to 15.0.0. instead of 12.0.1 fixed this issue for me.
i see at least 2 problems in your gradle file:
You have a duplicated entry for "kotlin-stdlib-jre7" (one implementation and one compile). Remove the last one:
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
Not using the latest versions of firebase & google play services: update to firebase 11.6.2
The other thing that may happen is that you are using implementation instead of api for one of your dependencies which may conflict with another dependency in your module.
Add following in gradle:-
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
If you are using firebase-bom, then you should update to latest version. For me, after upgading to latest it started working.
Lastest version as of now :
com.google.firebase:firebase-bom:24.5.0
You can check latest version HERE
add this solves my problem
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

Categories

Resources