The error message 'FATAL EXCEPTION: main' indicates that the FirebaseApp is not initialized in the specified process. The app needs to call 'FirebaseApp.initializeApp(Context)' first before calling 'FirebaseMessaging.getInstance()'.

In this specific case, the error occurred in 'MainActivity.java' at line 143 where 'uploadFirebaseToken()' is called. The method is trying to get an instance of 'FirebaseMessaging' without initializing 'FirebaseApp' first.

To fix this error, add the following line of code in the 'onCreate()' method of 'MainActivity.java' before calling 'uploadFirebaseToken()':

'FirebaseApp.initializeApp(this);'

This initializes the default 'FirebaseApp' in the current context, allowing 'FirebaseMessaging.getInstance()' to work properly.

Android FirebaseApp Not Initialized Error:  'FATAL EXCEPTION: main' Solution

原文地址: https://www.cveoy.top/t/topic/mkJy 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录