Open jperedadnr opened 3 years ago
This exception is already correctly handled. The actual fatal crash happens later on when trying to initialize Firebase in DalvikPushNotificationsService.initializeFirebase()
:
10-29 12:31:11.799 7338 11292 F com.d: java_vm_ext.cc:577] JNI DETECTED ERROR IN APPLICATION: JNI NewStringUTF called with pending exception java.lang.IllegalArgumentException: ApplicationId must be set.
10-29 12:31:11.799 7338 11292 F com.d: java_vm_ext.cc:577] at java.lang.String com.google.android.gms.common.internal.Preconditions.checkNotEmpty(java.lang.String, java.lang.Object) ((null):8)
10-29 12:31:11.799 7338 11292 F com.d: java_vm_ext.cc:577] at com.google.firebase.FirebaseOptions$Builder com.google.firebase.FirebaseOptions$Builder.setApplicationId(java.lang.String) (com.google.firebase:firebase-common@@19.3.0:87)
10-29 12:31:11.799 7338 11292 F com.d: java_vm_ext.cc:577] at void com.gluonhq.helloandroid.DalvikPushNotificationsService.initializeFirebase(java.lang.String, java.lang.String, java.lang.String, java.lang.String) (DalvikPushNotificationsService.java:93)
Right, in any case:
we should prevent the NPE (by checking that the file exists before calling Json.createReader()
, and also prevent the JNI error by not passing an empty configuration to Firebase.
google-services.json is needed for Android, but if it is not present it causes a NPE:
This should be avoided.