Skip to content Skip to sidebar Skip to footer

How To Fix Java.lang.runtimeexception On Android Studio?

I'm trying to retrieve the registration token from my device using Firebase in an app which has a TextView that has as a purpose to contain the value of the token in it, when runni

Solution 1:

From the docs:

For a vast majority of apps, FirebaseInitProvider will handle the initialization of Firebase for the default project that it's configured to work with, via the data contained in the app's google-services.json file.

In the event that an app requires access to another Firebase project in addition to the default project, initializeApp(Context, FirebaseOptions, String) must be used to create that relationship programmatically.

If you are using this app in two different projects then you need to use initializeApp().

https://firebase.google.com/docs/reference/android/com/google/firebase/FirebaseApp

Also update your Google service version to 4.2.0 as 4.1.0 had configuration issues.

classpath 'com.google.gms:google-services:4.2.0'

Solution 2:

Add apply plugin: 'com.google.gms.google-services' at the end of app gradle:

 dependencies {
     classpath 'com.android.tools.build:gradle:3.3.2'
     classpath 'com.google.gms:google-services:4.2.0'
     ...
 }
 apply plugin: 'com.google.gms.google-services'

Post a Comment for "How To Fix Java.lang.runtimeexception On Android Studio?"