Cannot resolve error in Firebase Chat application - android

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.

Related

Android Firebase API initialization failure

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

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'

Authorizing google API error

I'm trying to Authorizing and using googel API for android but when I try to configure build dependencies and sync the project it give me an error like
Error:Execution failed for task ':app:prepareDebugAndroidTestDependencies'.> Dependency Error.
See console for details.
build gradle (app):
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:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.google.api-client:google-api-client:1.22.0'
compile 'com.google.api-client:google-api-client-android:1.22.0'
compile 'com.google.apis:google-api-services-people:v1-rev4-1.22.0'
how can I solve this?
Not sure, but I think your google apis are conflicting
compile 'com.google.android.gms:play-services-auth:10.2.0'
and
compile 'com.google.api-client:google-api-client:1.22.0'
Might internally be using other dependencies, with different versions.
Try running: /gradlew app:dependencies to see all your dependencies

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/api/zza.class

Below is the error I am getting after adding the Firebase, google services in gradle and google-services.json in app module.
I have 13 modules in my app. I have 7 build variants in all the modules. I tried with placing the google-services.json in app module and placing it in build variant folder inside the app module. I am getting same error. I have the notification feature in one build variant.
I removed the firebase related code in gradle and google-services.json from application, it is working perfectly.
Due to security reason I can't share the entire file.
Main app module gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
compile('com.crashlytics.sdk.android:crashlytics:2.6.2#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.github.hotchemi:permissionsdispatcher:2.0.7'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.7'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:multidex:1.0.1'
}
In Application gradle:
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
}
:app:transformClassesWithJarMergingForSmePreDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForSmePreDebug'.>
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/google/android/gms/common/api/zza.class
I reffered many links in StackOverflow for this issue. None fixed my problem. Any suggestions appreciated.
Edited push notification module gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
//compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.8.0'
//compile ('com.google.firebase:firebase-messaging:9.8.0') {
//exclude group: 'com.google.android.gms'
//}
}
apply plugin: 'com.google.gms.google-services'
This issue might because you have duplicate dependencies. One has latest version and the other one has old version.
What you can do is
check your app dependecies.
./gradlew clean :app:dependencies
find 3rd party libraries that also have com.google.android.gms included.
exclude this group from the library
compile ('library') {
exclude group: 'com.google.android.gms'
}
This might be able to be a quick fix. But it's not good!
The best solution should be updating your 3rd party library, their latest version might update their google services library already.

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