它是在更改Firebase版本之后发生的。
它不会在我的设备上发生,只能在Crashlytics中找到。
Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{com.myApp /com.myApp.MainActivity}: java.util.ConcurrentModificationException
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2957)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by java.util.ConcurrentModificationException
androidx.collection.SimpleArrayMap.put (SimpleArrayMap.java:482)
androidx.appcompat.app.AppCompatActivity.onCreate (AppCompatActivity.java:106)
com.facebook.react.ReactActivity.onCreate (ReactActivity.java:43)
com.cotoone.nagizi.MainActivity.onCreate (MainActivity.java:22)
android.app.Activity.performCreate (Activity.java:7183)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
MainActivity
package com.myApp;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import org.devio.rn.splashscreen.SplashScreen;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this,true); // here
super.onCreate(savedInstanceState);
}
@Override
protected String getMainComponentName() {
return "test3";
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}
变更日志
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-messaging:18.0.0"
implementation "com.google.firebase:firebase-ads:17.2.1"
到
implementation "com.google.android.gms:play-services-base:17.2.1"
implementation 'com.google.firebase:firebase-messaging:+'
implementation "com.google.firebase:firebase-ads:19.1.0"
在这种状态下发生错误。
我这样做是通过搜索找到的解决方案的。
implementation "com.google.firebase:firebase-core:16.0.8"
到
implementation "com.google.firebase:firebase-core:17.2.0"
但我仍然遇到相同的错误。
现在使用
implementation "com.google.android.gms:play-services-base:17.2.1"
implementation "com.google.firebase:firebase-core:17.2.0"
implementation 'com.google.firebase:firebase-messaging:+'
implementation "com.google.firebase:firebase-ads:19.1.0"
implementation "com.google.firebase:firebase-perf:17.0.2"
implementation 'com.google.android.gms:play-services-location:16.0.0'