最佳答案
在迁移到 Firebase 云消息之后。当打开我的应用程序,它崩溃,抛出一个错误说 java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.
我已经把我的新的谷歌服务。Json 和更新我的 SDK。
这是我的主要活动
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());
}
}