Following this tutorial I try to integrate the Firebase SDK in an Android application (in fact it is a ReactNative-Application but on this level it doesn't matter) but run into several compiler-errors when it comes to use the classes from firebase-messaging.
The compiler states that only versions 9.0.0 are compatible with each other. But these versions can't be used with the client side code that was listed in the tutorial.
Some people (A, B) write, that firebase-messaging must be compiled in V 9.2.1 or 10.0.1, but Android Studio complaints then, that these versions are not compatible to google-play-services 10.0.1. The same happens, when i increase google-play-services to 11.0.1 (there is no 10.0 or 9.2 available):
Found com.google.firebase:firebase-core:9.2.1, but version 9.0.0 is needed for the google-services plugin.
Found com.google.firebase:firebase-messaging:9.2.1, but version 9.0.0 is needed for the google-services plugin.
:app:processDebugGoogleServices FAILED
FAILURE: Build failed with an exception.
* What went wrong:
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.
These are the compiler errors:
1. Cannot access AbstractSafeParcelable
error: cannot access AbstractSafeParcelable i.putExtra("data", remoteMessage);
package com.cooblr.notification;
import android.content.Intent;
import android.util.Log;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
public class MessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Intent i = new Intent("Message");
i.putExtra("data", remoteMessage);
sendOrderedBroadcast(i, null);
}
}
2. AbstractSafeParcelable not found
class file for com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable not found
and so on...
Gradle:
./android/build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.1.0'
./android/app/build.gradle:
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.firebase:firebase-messaging:9.2.1'