React-native-fcm: App crashing only on Android

Created on 5 Jun 2018  路  5Comments  路  Source: evollu/react-native-fcm

Before openning an issue

  1. Reproduce it with the example project in this repo.
  2. If you can't receive iOS notification, make sure you can receive notification using quickstart-ios project provided by Firebase team

When openning an issue, please include following information for better support

  1. What version of RN and react-native-fcm are you running? RN = 0.54.0, react-native-fcm: latest version (15.0.2)
  2. What device are you using? (e.g iOS9 emulator, Android 6 device)? Pixel 2 API 27
  3. Is your app running in foreground, background or not running? foreground

Hi Evollu,

I'm having a new issue with the component that crashes the Android app. The fatal error displayed on Logcat when this occurs is:

06-05 18:49:14.678 5460-5460/airix.mobile I/zygote: Rejecting re-init on previously-failed class java.lang.Class: java.lang.IllegalAccessError: Class com.google.android.gms.internal.zzbfm extended by class com.google.firebase.messaging.RemoteMessage is inaccessible (declaration of 'com.google.firebase.messaging.RemoteMessage' appears in /data/app/airix.mobile-cCi2-cSxqp3WdSwbOUicpg==/split_lib_dependencies_apk.apk)

I've checked and all the imports seem to be as suggested by you on your readme. Would you have any ideas or any clues? I'm not finding similar errors online anywhere.

Thanks very much.

Most helpful comment

4 days reading gradle, updating dependencies like a crazy, my solution if it works for anybody there @ruk91
android/build.gradle

buildscript { 
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'
        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
    }

android/app/build.gradle

dependencies { 
    // ....

    // Push notifications FCM
    compile project(':react-native-fcm')
    // Firebase dependencies <HERE>
    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.firebase:firebase-core:15.0.2"
    implementation "com.google.firebase:firebase-messaging:15.0.2"

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:26.0.1"
    compile ('com.facebook.react:react-native:0.46.4') { force = true } // super hack! From node_modules
}

All 5 comments

Sorry, this is actually my bad. It was related to not importing a non-deprecated version of firebase cloud messaging. Very confusing stuff.

Could you paste the change please... because yes this android versioning change are really confusing , thanks @404sand808s

@404sand808s, Can you mention the correct imports?

4 days reading gradle, updating dependencies like a crazy, my solution if it works for anybody there @ruk91
android/build.gradle

buildscript { 
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'
        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
    }

android/app/build.gradle

dependencies { 
    // ....

    // Push notifications FCM
    compile project(':react-native-fcm')
    // Firebase dependencies <HERE>
    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.firebase:firebase-core:15.0.2"
    implementation "com.google.firebase:firebase-messaging:15.0.2"

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:26.0.1"
    compile ('com.facebook.react:react-native:0.46.4') { force = true } // super hack! From node_modules
}

@jamesjara, Thanks so much. It's my 3rd day. Thanks again!!!

Was this page helpful?
0 / 5 - 0 ratings