迁移到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());
}
}
apply plugin: 'com.google.gms.google-services'
从我的应用程序,但gradle这个调用时遇到一个新的错误FirebaseInstanceId.getInstance().getToken()
在我的MainActivity
我的应用程序崩溃。