相关疑难解决方法(0)

名称为[DEFAULT]的FirebaseApp不存在

迁移到Firebase Cloud Messaging后.当打开我的应用程序时,它会崩溃并抛出错误,说java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.我已经放入了我的新google-services.json并更新了我的SDK.

这是我的MainActivity

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

//Check Google play service
    GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
    int resultCode = googleAPI.isGooglePlayServicesAvailable(this);

    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            GooglePlayServicesUtil.getErrorDialog(resultCode, this,
                    PLAY_SERVICES_RESOLUTION_REQUEST).show();
        } else {
            Log.e(LOG_TAG, "This device is not supported.");
            finish();
        }
    }

    Log.i(TAG, "InstanceID token: " + FirebaseInstanceId.getInstance().getToken());

}
}
Run Code Online (Sandbox Code Playgroud)

java android firebase

71
推荐指数
5
解决办法
4万
查看次数

标签 统计

android ×1

firebase ×1

java ×1