OneSignal / OneSignal-Android-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
Other
602 stars 367 forks source link

Huawei Onesignal Crash (java.lang.IllegalStateException) #1096

Closed Deepan27 closed 4 years ago

Deepan27 commented 4 years ago

Description:

App is crashing in random huawei devices when opening the app. The app is currently integrated with OneSignal. Already followed the guide provided by OneSignal for huawei integration. No firebase or google services are added into the app.

Log from android studio:

D/FirebaseApp: Default FirebaseApp failed to initialize because no default options were found. This usually means that com.google.gms:google-services was not applied to your gradle project.

I/FirebaseInitProvider: FirebaseApp initialization unsuccessful

Environment

  1. Added using gradle (com.onesignal:OneSignal:3.15.1)
  2. 'com.huawei.agconnect:agcp:1.3.1.300'
  3. 'https://developer.huawei.com/repo/'

Steps to Reproduce Issue:

App crashes when opening the app

Crash report from huawei developer console

java.lang.IllegalStateException

com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@16.0.2:240) com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source:1) com.google.firebase. iid.zzaw.zzg(Unknown Source:52) com.google.firebase.iid.FirebaseInstanceId.zzi(Unknown Source:60) com.google.firebase.iid.FirebaseInstanceId.zza(Unknown Source:147) com.google.firebase .iid.zzn.run(Unknown Source:10) java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) java.util.concurrent. ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) java.lang.Thread.run(Thread.java:784)

jkasten2 commented 4 years ago

@Deepan27 The crash you are seeing is a bug specific to the Firebase version in your app. Updating it should solve your issue noted here: https://github.com/OneSignal/OneSignal-Android-SDK/issues/681#issuecomment-632933988

Deepan27 commented 4 years ago

There is no Firebase dependencies added as we are using Huawei libraries. Removed all the firebase dependencies and google services and we using OneSignal with the latest version com.onesignal:OneSignal:3.15.1

jkasten2 commented 4 years ago

OneSignal includes Firebase as a dependency, you have to exclude from OneSignal so it isn't added automatically for your Huawei AppGallery builds if you don't need it. See this guide on doing so. https://documentation.onesignal.com/docs/huawei-sdk-setup#step-8---optional-omit-google-libraries-for-huawei-appgallery-builds

Deepan27 commented 4 years ago

OneSignal includes Firebase as a dependency, you have to exclude from OneSignal so it isn't added automatically for your Huawei AppGallery builds if you don't need it. See this guide on doing so. https://documentation.onesignal.com/docs/huawei-sdk-setup#step-8---optional-omit-google-libraries-for-huawei-appgallery-builds

Thank you very much this solves the problem