Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
254 views
in Technique[技术] by (71.8m points)

android - java.util.ConcurrentModificationException in activity onCreate

In a recent release where I added MoPub via Admob ad mediation I am seeing a bunch of ConcurrentModificationException in crash logs. It all seems to be native code and I am on the latest version of all ad related and google/android related libraries. Anyone run in to this before?

java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3121)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3264)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1955)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:7078)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:964)
Caused by: java.util.ConcurrentModificationException: 
  at androidx.c.g.put (SimpleArrayMap.java:482)
  at com.google.android.gms.measurement.internal.hs.a
  at com.google.android.gms.measurement.internal.hi.onActivityCreated
  at android.app.Application.dispatchActivityCreated (Application.java:245)
  at android.app.Activity.onCreate (Activity.java:1108)
  at androidx.core.app.e.onCreate (ComponentActivity.java:81)
  at androidx.activity.b.onCreate (ComponentActivity.java:149)
  at androidx.fragment.app.c.onCreate (FragmentActivity.java:313)
  at androidx.appcompat.app.e.onCreate (AppCompatActivity.java:106)
  at com.teamtol.livedota.BaseActivity.onCreate (BaseActivity.java:21)
  at com.teamtol.livedota.RecentGameActivity.onCreate (RecentGameActivity.java:70)
  at android.app.Activity.performCreate (Activity.java:7327)
  at android.app.Activity.performCreate (Activity.java:7318)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1275)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3101)

This is what the code looks like up to line 21 of BaseActivity:

protected void onCreate(Bundle savedInstanceState) {
        supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
        super.onCreate(savedInstanceState);

This is what the code looks like up to line 70 of RecentGameActivity

public class RecentGameActivity extends BaseActivity implements AdapterView.OnItemSelectedListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In our case, we are only seeing the crash with

com.google.firebase:firebase-analytics:17.2.2 

reverting to 17.2.1 has fixed the problem

This happens too if you are using firebase-core:17.2.2, because firebase-analytics is the same library rebranded. Take into account that as per official docs, current usage of firebase-core is deprecated -> https://firebase.google.com/support/release-notes/android#latest_sdk_versions


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...