gpt4 book ai didi

android - 如何解决 ConcurrentModificationException

转载 作者:行者123 更新时间:2023-12-03 16:22:16 32 4
gpt4 key购买 nike

更新应用程序后,我收到来自 Firebase 的错误几乎在所有 Activity 中。

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.project.app/com.project.app.MainActivity}: java.util.ConcurrentModificationException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895)
at android.app.ActivityThread.-wrap11()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)

Caused by java.util.ConcurrentModificationException
at androidx.collection.SimpleArrayMap.put(SimpleArrayMap.java:482)
at com.google.android.gms.measurement.internal.zzin.zza(com.google.android.gms:play-services-measurement-impl@@17.2.2:108)
at com.google.android.gms.measurement.internal.zzid.onActivityCreated(com.google.android.gms:play-services-measurement-impl@@17.2.2:11)
at android.app.Application.dispatchActivityCreated(Application.java:199)
at android.app.Activity.onCreate(Activity.java:1034)
at androidx.core.app.ComponentActivity.onCreate(ComponentActivity.java:81)
at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:149)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:313)
at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:106)
at com.project.app.MainActivity.onCreate(MainActivity.java:74)
at android.app.Activity.performCreate(Activity.java:7088)
at android.app.Activity.performCreate(Activity.java:7079)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895)
at android.app.ActivityThread.-wrap11()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)

我确定更改后出现问题 build.gradle (模块:应用程序)。

这是 build.gradle 的一些行(旧版):
implementation 'com.google.android.material:material:1.2.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'
implementation 'com.android.billingclient:billing:2.0.3'
implementation 'com.google.firebase:firebase-ads:18.3.0'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

这是 build.gradle 的一些行(新版本):
implementation 'com.google.android.material:material:1.2.0-alpha04'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'com.android.billingclient:billing:2.1.0'
implementation 'com.google.firebase:firebase-ads:18.3.0'
//implementation 'com.google.firebase:firebase-core:17.2.2'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

我认为是由于 firebase-analytics:17.2.2,但我不确定。
你觉得问题出在哪里?我需要降级到旧版本吗?

最佳答案

这是因为 firebase-core lib
他们在 17.2.3 版本中修复了它,请参阅更新日志:https://firebase.google.com/support/release-notes/android#analytics_v17-2-3

改变你的
'com.google.firebase:firebase-core:17.2.1'

'com.google.firebase:firebase-core:17.2.3'

关于android - 如何解决 ConcurrentModificationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60140603/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com