Firebase not intialise android react native

I am building an app for android from react native. 

I am able to setup everything but once I run the project in android I get this error. Please help me to resolve this I am unable to find anything related to this.

2020-07-24 11:11:43.951 3200-3229/com.basicstructure E/BasicStructure - UALib: Unable to register with FCM.

java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.basicstructure. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@19.3.0:184)
at com.urbanairship.push.fcm.FcmPushProvider.isAvailable(FcmPushProvider.java:88)
at com.urbanairship.push.PushManager.performPushRegistration(PushManager.java:1017)
at com.urbanairship.push.PushManager.extendChannelRegistrationPayload(PushManager.java:331)
at com.urbanairship.push.PushManager.access$000(PushManager.java:53)
at com.urbanairship.push.PushManager$1.extend(PushManager.java:288)
at com.urbanairship.channel.AirshipChannel.getNextChannelRegistrationPayload(AirshipChannel.java:522)
at com.urbanairship.channel.AirshipChannel.onPerformJob(AirshipChannel.java:222)
at com.urbanairship.job.Job$1.run(Job.java:90)
at com.urbanairship.util.SerialExecutor$1.run(SerialExecutor.java:41)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.urbanairship.util.AirshipThreadFactory$1.run(AirshipThreadFactory.java:50)
at java.lang.Thread.run(Thread.java:923)
2020-07-24 11:11:43.951 3200-3229/com.basicstructure W/BasicStructure - UALib: PushManager - Push registration failed. Push provider unavailable: FCM Push Provider 13.3.0

Didn't find what you were looking for?

New post

Comments

2 comments

  • Hello Krupali!

    This is Mikey with Airship Technical Support. Thank you for providing these log files. It looks like your Firebase integration is not properly configured to register for push notifications with Airship. I recommend reviewing our documentation on the React Native Android setup to ensure that no steps were missed in the process. Specifically, the implementation of the google-services.json from the application’s Firebase console into the root directory at android/app/google-services.json. 

    If you are using a third-party push provider in tandem with Airship, you'll need to follow the steps outlined here to forward onNewToken and onMessageReceived received calls to the Airship SDK. 

     

    If all else fails, we strongly encourage using our Sample App for React Native to build a working implementation that can help you better understand where the break down is happening. 

    I hope this helps!

    Mikey R.

    Airship | Technical Support Engineer | Portland, OR

    Comment actions Permalink
  • Solved by:

    completely removed all react-native-firebase references in android/ folder: manually unlinked the project, remove 'apply plugin' at the bottom of android/app/build.gradle file, removed gms dependency in android/build.gradle, cleaned AndroidManifest.xml from react-native-firebase services and receivers
    npm uninstall --save react-native-firebase
    cd android && ./gradlew clean

    Then I had to update all my play-services dependencies in android/app/build.gradle to 11.6.0 version, because firebase is using 11.6.0 at the moment I'm writing this post.

    Here is how my android/app/build.gradle dependencies block looks like:

    dependencies {

        compile(project(':react-native-firebase')) {
        transitive = false
        }

        // Firebase dependencies
        compile "com.google.firebase:firebase-core:11.6.0"
        compile "com.google.firebase:firebase-messaging:11.6.0"

        compile project(':react-native-background-timer')
        
        compile(project(':react-native-maps')) {
            exclude group: 'com.google.android.gms'
        }

        compile (project(':react-native-device-info')) {
            exclude group: "com.google.android.gms" 
        }

        compile (project(':react-native-camera')) {
        exclude group: "com.google.android.gms"
        }

        compile project(':react-native-image-picker')
        compile project(':react-native-oauth')
        compile project(':react-native-svg')
        compile project(':react-native-vector-icons')
        compile project(':react-native-device-info')
        compile project(path: ':react-native-interactable')
        compile project(':react-native-photo-view')

        compile fileTree(dir: "libs", include: ["*.jar"])
        compile "com.android.support:appcompat-v7:23.0.1"
        compile "com.facebook.react:react-native:+"  // From node_modules

        compile ("com.google.android.gms:play-services-base:11.6.0") {
            force = true;
        }
        compile ("com.google.android.gms:play-services-maps:11.6.0") {
            force = true;
        }
        compile ("com.google.android.gms:play-services-gcm:11.6.0") {
            force = true;
        }

        compile project(':react-native-facebook-login')
        compile project(':react-native-check-app-install')
        compile project(':react-native-fetch-blob')

        compile project(':non-conflicting-webview')
    }



    Regards,
    Rachel Gomez
    Comment actions Permalink
    0

Please sign in to leave a comment.