gpt4 book ai didi

java - 名称为 [DEFAULT] 的 FirebaseApp 不存在

转载 作者:IT老高 更新时间:2023-10-28 13:17:08 26 4
gpt4 key购买 nike

迁移到 Firebase Cloud Messaging 后。打开我的应用程序时,它崩溃并抛出错误提示 java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] 不存在。 我已经把我的新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());

}
}

最佳答案

请仔细检查,你添加了

apply plugin: 'com.google.gms.google-services' 

在应用程序的 gradle 文件的底部,然后清理并重建项目

关于java - 名称为 [DEFAULT] 的 FirebaseApp 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37342403/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com