Push Notification using FCM in android - android

And i am new in Android Studio so i am not understand.
I am new in Push Notification using FCM but i not getting solution.
i m getting this type of error during run time.
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.6.0.
My App/Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "info.androidhive.firebasenotifications"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar']) // old default
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.0.0-beta1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-messaging:9.6.0'
compile 'com.google.android.gms:play-services:7.5.0'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
This is my project gradle
buildscript {
repositories {
jcenter()
}
dependencies {
// classpath 'com.android.tools.build:gradle:2.2.3'
// classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
i have update android studio SDK nothing to left from my side but i don't know where i do mistake.
So please help me on this.

Your gms version is 7.5.0, change it to same version as firebase version or you can update both to latest version.
Update your firebase and play-services to version 10.2.0 in app module build.gradle file
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.android.gms:play-services:10.2.0'

Related

Error when trying to add firebase libraries to app that uses google maps API

I have an android app that I want to add firebase messaging service functionality so I can receieve notifications that are sent from my self-built server to the firebase cloud.
I started adding the configuration lines to the gradle files, but after adding the
apply plugin: 'com.google.gms.google-services'
line, I get an error 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 11.0.2.
This is my module:app gradle script file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "br.com.berait.brecar"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.android.gms:play-services-maps:11.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.android.support:design:25.3.1'
compile 'com.wdullaer:materialdatetimepicker:3.2.2'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
compile 'com.google.firebase:firebase-messaging:10.2.6'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
if needed, this is my project level gradle script file:
//Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have searched S.O for sometime now and all the answers to this type of error haven't worked for me. As you can see, i have the apply plugin line at the bottom of the file. I believe the conflict is being generated by the
compile 'com.google.android.gms:play-services-maps:11.0.2'
line, which was automatically added when I added google maps API support to my application.
Any help is appreciated, thanks in advance!
Bump up the firebase dependency version to
compile 'com.google.firebase:firebase-messaging:11.0.2'
or lower the maps dependency to
compile 'com.google.android.gms:play-services-maps:10.2.6'

Android Studio, Google Firebase, Google Maps

I am using Android Studio 2.3 on a mac mini.
I began by opening a fresh project.
MainActivity is a loadingScreen
connect project to firebase using Firebase Assistant
Write to firebase
Everything works up to here.
Then I attempt to add a GoogleMaps Activity and the project no longer compiles. The error I am being shown is:
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.
app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "us.n_e_ar.akita"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And here is the other gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// 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 {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Thank you in advance.
The versions of the Firebase and Google Play Services libraries must be identical. You can either downgrade to 10.0.1:
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
or upgrade to 10.2.1:
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
While you updating, it's probably wise to use the latest constraint layout lib:
compile 'com.android.support.constraint:constraint-layout:1.0.2'

Gradle Build Error After Creating Google Maps Activity

I've added an empty google maps activity to my project in android studio but I'm receiving this 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 10.0.1.
My app level build.gradle file contains:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "XXXXXXXXXX"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.1.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.android.support:design:25.1.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-maps:10.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
My project level build.gradle file contains:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
How can I resolve this issue? Any help is appreciated, thank you.
Update the packagecom.google.firebase:firebase-auth:10.0.1 to com.google.firebase:firebase-auth:10.2.0.
You should try using the same version of libraries based on play-services to avoid conflicts
Instead of using compile 'com.google.android.gms:play-services-maps:10.2.0' use this compile com.google.android.gms:play-services-maps:10.0.1'

Version conflict in gradle while adding com.google.gms.google-services

I was adding firebase cloud messaging to my project using the assistant, I encountered the following error message while android studio was building the project :
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.8.0.
Here are the build files:
top-level:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// 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 {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app-level:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "in.ac.iitb.treeplantationapp"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.0.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:design:25.0.1'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.google.android.gms:play-services:10.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
You are using different versions of the google play services:
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.google.android.gms:play-services:10.0.0'
compile 'com.google.firebase:firebase-messaging:10.0.1'
Use:
compile 'com.google.android.gms:play-services-appindexing:10.0.1'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'

Firebase server SDK setup issuse

I am setting up an Android server project for pushing notification using this documentation from Firebase website. At first, I have set up the project at Firebase console and added the JSON file & Google services plugin.
But while syncing the project after adding
compile 'com.google.firebase:firebase-server-sdk:3.0.1', there is the error:
Version: 3.0.1 is lower than the minimum version (9.0.0) required for google-services plugin.
My app build.gradle is-
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "ton.com.serverandroid"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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'
compile 'com.google.firebase:firebase-server-sdk:3.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
My project build.gradle is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried to use google-services version 2.1.0 but it wasn't working either with the error:
Conflict with dependency 'com.google.code.findbugs:jsr305'. Resolved versions for app (1.3.9) and test app (2.0.1) differ.
But I can't go farther in that case.
I answer a similar question today, you can see the correct dependences here enter link description here, this ones are most important to import other dependencies in android client. Then for server sdk you need to add this one in app.gradle:
compile 'com.google.firebase:firebase-server-sdk:[3.0.0,)'
For use FirebaseCloudMessaging you need other one in app.gradle:
compile 'com.google.firebase:firebase-messaging:9.0.0'
Tell us if you wan compile now, greetings!

Categories

Resources