Android Firebase API initialization failure - android

Following this guide, I'm trying to implement notifications through firebase.
I have followed the guide, updated build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:multidex:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-crash:9.0.0'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
However when testing i get the error:
E/DynamiteModule: Failed to load module descriptor class: Didn't find
class
"com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor"
E/FirebaseApp: Firebase API initialization failure.
I have looked at other questions relating to this issue, but there has been no useful solution.
I have also tried modifying dependency version to the latest 11.4.2, only to see the following error:
Error:Execution failed for task ':app:processDebugGoogleServices'.
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 9.0.0.
Commenting out all dependencies except firebase/play-services, does not resolve the above

A simple solution is that use Fireabase Assistant to initialize the Firebase in your application
First remove all firebase dependency and apply plugin: 'com.google.gms.google-services' from your app gradle ( in Android Studio 2.3.3) follow this step
Tools > Firebase
(On right tab) Assistant > Authentication

Related

Error for the version of google services [duplicate]

This question already has answers here:
Error : Please fix the version conflict either by updating the version of the google-services plugin
(2 answers)
Closed 5 years ago.
Even after updating the version same error continues to pop up whenever the gradle is built.
Project base gradle
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
}
**App base gradle **
ependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:9.2.0'
compile 'com.github.barteksc:android-pdf-viewer:2.4.0'
compile 'com.google.firebase:firebase-storage:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
and the error is shown as follows:-
Error:Execution failed for task ':app:processDebugGoogleServices'.
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 10.0.1.
Please help me to solve the issue.
Your all firebase version should be same.
compile 'com.google.firebase:firebase-database:9.2.0'
update it
compile 'com.google.firebase:firebase-database:10.0.1'

firebase and com.google.android.gms

I just added firebase support to my android app. At first it worked fine. However, in order to track stacktraces I added the following stuff to my app/gradle.build:
compile 'com.google.firebase:firebase-crash:10.2.6'
such that it looks like this right now:
dependencies {
compile 'com.google.firebase:firebase-core:11.0.0'
compile 'com.google.firebase:firebase-crash:10.2.6'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
However, when I want to start my app now I am getting the following error message:
Error:Execution failed for task ':app:processDebugGoogleServices'.
> 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 11.0.0.
I first checked in the SDK manager that everything was up to date and it is:
Since it did not work, I tried to add the required dependency manually like this:
compile 'com.google.gms:google-services:3.1.0'
Didn't work either. What am I doing wrong here?
Make sure following dependencies are using the same version.
compile 'com.google.firebase:firebase-core:11.0.0'
compile 'com.google.firebase:firebase-crash:10.2.6'

Cannot resolve error in Firebase Chat application

Im trying chat application using firebase. Im getting following error which could nit resolve myself,
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzble.class
I have mentioned below my gradle file
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.android.support:design:25.3.1'
compile 'com.firebaseui:firebase-ui:1.1.1'
compile 'com.google.firebase:firebase-auth:10.2.4'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
FirebaseUI has transitive dependencies on a number of the Firebase libraries. You must specify a version of FirebaseUI that is compatible with the Firebase libraries you are using. The table of compatible versions is listed in the FirebaseUI documentation. The most recent FirebaseUI version is 1.2.0, which works with library version 10.2.0. A version of FirebaseUI for Firebase libs 10.2.4 and 10.2.6 has not been released.
The safe change is:
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
You could try 1.2.0 with 10.2.4 or 10.2.6, but may encounter the same problem you are seeing now.

Gradle sync failed: Could not find method compile() for arguments [com.android.support:appcompat-v7:25.3.1]

I am new to Android App Development. I am trying to create an Android app using TabLayout and have added the following dependencies in the build.gradle file.
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
}
But on running the App, I am getting build error as follows
Error:(27, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'MyFirstapp' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
Any suggestions on why this problem is there. I get an option to install Plugin from Android Studio but I don't know which plugin to install.
I'm guessing you are adding dependencies to the wrong build.gradle.
Try doing this:
In your first build.gradle replace the dependencies with this
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
and replace dependencies in build.gradle(Module:app) (2nd build.gradle file) with this
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

Google Map V2 and GCM in a project

i have a project that uses Google Map API v2, and now i want to add GCM to this project, when i add GCM dependency to my gradle file i face with this error:
Error:Execution failed for task ':app:processDebugResources'.
Error: more than one library with package name 'com.google.android.gms'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0
my dependencies are:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.github.rey5137:material:1.2.1'
compile ('com.google.android.gms:play-services:4.1.32')
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.jpardogo.materialtabstrip:library:1.1.0'
compile('com.balysv.materialmenu:material-menu:1.5.4') {
exclude group: 'com.nineoldandroids', module: 'library'
}
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:21.0.3'
}
what can i do?
compile ('com.google.android.gms:play-services:4.1.32')
compile 'com.google.android.gms:play-services-gcm:7.8.0'
Please DO NOT use two different version of Google Play Service.
Also, most importantly try using those gradle dependencies which required by your application instead of all dependencies. Check here

Categories

Resources