React-native-fcm: Runtime Exception 'no static method zzz' with new Android sdk google-services

Created on 23 Nov 2016  路  18Comments  路  Source: evollu/react-native-fcm

I have moved my application on a Mac OS X with a fresh installation of Android sdk with Google Play Services 38, and now the application doesn't start due to the following exception

_11-23 14:40:05.325: E/AndroidRuntime(6374): FATAL EXCEPTION: main
11-23 14:40:05.325: E/AndroidRuntime(6374): Process: com.newjoinapp, PID: 6374
11-23 14:40:05.325: E/AndroidRuntime(6374): java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzaa; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa' appears in /data/app/com.newjoinapp-1/base.apk)
11-23 14:40:05.325: E/AndroidRuntime(6374): at com.google.firebase.provider.FirebaseInitProvider.zza(Unknown Source)
11-23 14:40:05.325: E/AndroidRuntime(6374): at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
11-23 14:40:05.325: E/AndroidRuntime(6374): at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
11-23 14:40:05.325: E/AndroidRuntime(6374): at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
11-23 14:40:05.325: E/AndroidRuntime(6374): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
11-23 14:40:05.325: E/AndroidRuntime(6374): at android.app.ActivityThread.access$1500(ActivityThread.java:151)
11-23 14:40:05.325: E/AndroidRuntime(6374): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
11-23 14:40:05.325: E/AndroidRuntime(6374): at android.os.Handler.dispatchMessage(Handler.java:102)
11-23 14:40:05.325: E/AndroidRuntime(6374): at android.os.Looper.loop(Looper.java:135)
11-23 14:40:05.325: E/AndroidRuntime(6374): at android.app.ActivityThread.main(ActivityThread.java:5254)
11-23 14:40:05.325: E/AndroidRuntime(6374): at java.lang.reflect.Method.invoke(Native Method)
11-23 14:40:05.325: E/AndroidRuntime(6374): at java.lang.reflect.Method.invoke(Method.java:372)_

I'm using RN 0.37

Debug on Android Emulator 5.1.1 API Level 22

My app/build.gradle:

_dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile project(':react-native-device-info')
compile project(':react-native-fabric-digits')
compile project(':react-native-dcm')
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-contacts')
compile('com.digits.sdk.android:digits:1.9.2@aar') {
transitive = true;
}
}_

_apply plugin: 'com.google.gms.google-services'_

And the android/build.gradle:
_dependencies {
classpath 'com.android.tools.build:grade:2.2.1'
classpath 'com.google.gms:google-services:3.0.0'
}_

Most helpful comment

I had this issue and the cause was that react-native-maps library was using different version of play services then Firebase.

I had to update node_modules/react-native-maps/android/build.gradle
At the bottom of the file I changed version to be the same as firebase-core version.

dependencies {
  compile "com.facebook.react:react-native:+"
  compile "com.google.android.gms:play-services-base:10.0.1"
  compile "com.google.android.gms:play-services-maps:10.0.1"
}

I also updated gradle to latest version in both build.gradle (react-native-maps) and build.gradle in Android folder:

classpath 'com.android.tools.build:gradle:2.2.3'

You can check if there are duplicate versions in Android studio by clicking project tab on the left side menu under the name of your project and opening "external libraries.

You can also check dependency tree by running:

Check this comment and comments below for more help:

http://stackoverflow.com/a/26722850/5100389

All 18 comments

try firebase 10.0.0 version
i have compile 'com.google.firebase:firebase-core:10.0.0' in my main app's build.gradle

even with 10.0.0 I get this error

it's working for me now. make sure, every package you have installed, uses the same version of firebase libraries

@edy what is your final build.gradle config?

I'm having the same error here

@Marco62 did u figure it out?

using compile 'com.google.firebase:firebase-crash:10.0.1' fixed for me with latest version of react-native-fcm

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    // From node_modules
    compile project(':react-native-fcm')
    // ...
    compile 'com.google.firebase:firebase-core:10.0.0'
    compile 'com.google.firebase:firebase-crash:10.0.0'
}

Additionally i set the firebase version number in node_modules/react-native-fcm/android/build.gradle to 10.0.0

Hi, I solved that problem by adding compile 'com.google.firebase:firebase-core:10.0.0' on the dependencies on app/build.gradle

But after that I got this error every time I receive a notification:

java.lang.AbstractMethodError: abstract method "android.content.Intent com.google.firebase.iid.zzb.zzF(android.content.Intent)"
at com.google.firebase.iid.zzb.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3010)
at android.app.ActivityThread.-wrap17(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1442)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Any ideas ?

can you check if you have any other dependency that declare lower version of firebase dependency?

Noup, the only place that appears com.google.firebase:firebase* in the whole project is in the file I modified previously.

try updating the google repository in android studio?

I have the version 40, I think is the last one.

I tried what @edy suggested, by changing the dependecies to 10.0.0 in node_modules/react-native-fcm/android/build.gradle

After this, everything is working

Thanks

@Marco62 is this solved?

even after 40c7ee1295b3979fd8550e760d16c7b0b32c22f1 and not patching the + to 10.0.x, it works for me

I had this issue and the cause was that react-native-maps library was using different version of play services then Firebase.

I had to update node_modules/react-native-maps/android/build.gradle
At the bottom of the file I changed version to be the same as firebase-core version.

dependencies {
  compile "com.facebook.react:react-native:+"
  compile "com.google.android.gms:play-services-base:10.0.1"
  compile "com.google.android.gms:play-services-maps:10.0.1"
}

I also updated gradle to latest version in both build.gradle (react-native-maps) and build.gradle in Android folder:

classpath 'com.android.tools.build:gradle:2.2.3'

You can check if there are duplicate versions in Android studio by clicking project tab on the left side menu under the name of your project and opening "external libraries.

You can also check dependency tree by running:

Check this comment and comments below for more help:

http://stackoverflow.com/a/26722850/5100389

should not be an issue

@nikolal you are life saver. Thanks for saving my day

Was this page helpful?
0 / 5 - 0 ratings