Reputation: 51
Here is my build.gradle app file:
dependencies {
//picture library
compile 'com.github.bumptech.glide:glide:3.8.0'
//recycler and card view
compile 'com.android.support:support-v4:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.android.support:cardview-v7:26.+'
//json
compile 'com.google.code.gson:gson:2.8.5'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.retrofit2:retrofit:2.4.0'
//firebase
compile 'com.google.firebase:firebase-core:16.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Here is my build.gradle Project file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
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 {
jcenter()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am using Firebase Messaging Service, and I want to get notification into my app. So I am just checking the log for any update. My FirebaseMessagingService
file is:
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "onMessageReceived: "+remoteMessage.getNotification().getTitle());
Log.d(TAG, "onMessageReceived: "+remoteMessage.getNotification().getBody());
Log.d(TAG, "onMessageReceived: "+remoteMessage.getData());
}
While Compiling, I am getting error. How to resolve it?
Upvotes: 2
Views: 7170
Reputation: 138869
According to the firebase official documentation, please update your dependencies to the latest versions. So please change the following lines of code:
compile 'com.google.firebase:firebase-core:16.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
to
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
You can also upgrade the gradle of your project to the latest version:
classpath 'com.android.tools.build:gradle:3.1.4'
Upvotes: 6
Reputation: 313
If you are Getting this Error:
error: cannot access zza class file for com.google.android.gms.common.internal.safeparcel.zza not found
Then Use this:
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
api 'com.google.firebase:firebase-messaging:17.0.0'
It Works...
Upvotes: 3
Reputation: 4809
add This
compile 'com.google.firebase:firebase-core:16.0.3'
compile 'com.google.firebase:firebase-messaging:17.3.0'
Upvotes: 0