Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(3.2.3) Android app crashes with Java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.{appname}. Make sure to call FirebaseApp.initializeApp(Context) first when calling init() #515

Closed
bighitbiker3 opened this issue May 18, 2018 · 14 comments

Comments

@bighitbiker3
Copy link

Description:

When calling OneSignal.init() in Android the app crashes with the error Java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.reactnativeprototype. Make sure to call FirebaseApp.initializeApp(Context) first

When not calling init and initializing the old way in the build.gradle the ids event never fires.

Environment
SDK: v3.2.3

Steps to Reproduce Issue:

  1. Use OneSignal.init() in Android. App will crash immediately
@urbancvek
Copy link

Hoping for a solution too.. 😔

@justinphan1992
Copy link

Same issue

@Nightsd01
Copy link
Contributor

@bighitbiker3 If you initialize the old way - using build.gradle, you can call OneSignal.configure() in JS to get the ids event to fire.

As far as this particular FCM issue, we'll investigate, thanks for reporting

@bighitbiker3
Copy link
Author

bighitbiker3 commented May 19, 2018 via email

@michaelampr
Copy link

@bighitbiker3 the same for me. I tried many things and I had to downgrade to the 3.1.4 version to make it work again along with React Navigation (RN 0.55.4).

@bighitbiker3
Copy link
Author

@Nightsd01 The error I get when trying to run OneSignal.configure() to get the ids is You must initialize OneSignal before getting tags! Moving this tag operation to a pending queue.. This comes from the Android SDK here.

I've tried putting it in a timeout to make sure the Android init code is run before I call anything but still get the above error.

I'm having a hard time debugging from there because I'm a pretty big newb when it comes to importing external libraries in Android and RN 😅.

@Nightsd01
Copy link
Contributor

@bighitbiker3 Please try updating to 3.2.4 of the SDK and let me know if that fixes your issue.

@daniellrs
Copy link

I'm on version 3.2.4 and i'm getting the exact same error message when i call OneSignal.init()

@ramonsenadev
Copy link

I'm using 3.2.4 and having the same error with Onesignal.init()

@ramonsenadev
Copy link

ramonsenadev commented May 23, 2018

For now, it's working for me:

I updated my build.gradle for use a newer version (3.0.1) like in: .../examples/RNOneSignal/android/build.gradle

And also updated my gradle-wrapper.properties for gradle-4.1 like in: .../examples/RNOneSignal/android/gradle/wrapper/gradle-wrapper.properties

After that I start got some errors, then I changed my app/build.gradle:

...
dependencies {
    ...
    compile (project(':react-native-onesignal')){
        exclude group: "com.google.android.gms"
    }
    compile ("com.google.android.gms:play-services-base:12.0.1") {
        force = true;
    }
}
...

@daniellrs
Copy link

@ramonsenadev that worked, thanks!

@jsouza181
Copy link

To anyone still having trouble with this, note that the React Native setup instructions have recently been updated. This new section in particular is what got everything working for me on 3.2.4. I still had the compileSdkVersion and buildToolsVersion set to the React Native defaults.

@gulkush
Copy link

gulkush commented May 28, 2018

@ramonsenadev Thanks a lot. Your solution worked.
Few more steps i did after moving to onesignal v3.2.4 were:
compileSdkVersion 26
buildToolsVersion "26.0.1"
targetSdkVersion 26

Also make sure you update the android support library version
compile "com.android.support:appcompat-v7:26.0.1"

I also had to add following at the bottom of app/build.gradle

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.1'
            }
        }
    }
}

@bighitbiker3
Copy link
Author

Thanks OneSignal team! Appears to be fixed in 3.2.4. Everyone please check out the link in @jsouza181's comment. Worked great for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants