迁移到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());
}
}
守着星空守着你
慕尼黑的夜晚无繁华