First look at the logcat log:
2021-06-25 10:47:47.262 29869-29869/com.***.*** E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.***.***, PID: 29869
java.lang.RuntimeException: Error receiving broadcast Intent { act=com.***.servicecallback.content flg=0x10 (has extras) } in com.***.***.MainActivity$SocketMessageReceiver@b855039
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52497(LoadedApk.java:1323)
at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.next(ArrayList.java:860)
at com.***.***.MainActivity$SocketMessageReceiver.onReceive(MainActivity.java:733)
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52497(LoadedApk.java:1313)
at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
At first, I thought it was the problem of broadcast onreceiver
java.lang.RuntimeException: Error receiving broadcast Intent { act=com.***.servicecallback.content flg=0x10 (has extras) } in com.***.***.MainActivity$SocketMessageReceiver@b855039
Later, I found out that it was caused by the following sentence:
Caused by: java.util.ConcurrentModificationException
Look at the reason again: if you modify vector and ArrayList at the same time during iteration, you will throw a Java. Util. Concurrent modificationexception.
The reason is that I use the list when I process data in onreceiver. When I traverse and iterate the query, I insert the data, which leads to the collapse of the list.
Read More:
- Error querying database. Cause: java.util.ConcurrentModificationException
- Caused by: java.net.SocketException : connection reset or caused by: java.sql.SQLRecoverableException solve
- Caused by: java.lang.reflect.InvocationTargetExceptio
- Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process D:\….\0.jar
- Caused by: java.io.IOException: APR error: -730053
- Caused by: java.lang.IllegalStateException: Ambiguou There is already ‘XXXXXXController‘ bean method
- Caused by: java.lang.ClassNotFoundException: com.alibaba.nacos.api.naming.NamingMaintainService
- Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
- Solve the problem caused by: java.sql.SQLRecoverableException : IO error: connection reset related problems
- Exception on start hive: caused by: java.net.noroutetohostexception: no route to host
- Caused by: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0
- java.lang.IllegalStateException: Could not execute method for android:onClick
- Android error java.lang.IllegalStateException : System services not available to Activities before onC
- Solve the error reported by Android studio directly running java.main
- java.lang.NoSuchMethodError: org.json.JSONObject.put(Java/lang/String; Java/util/Collection;) “209151;”
- java.util.Collections.max() [How to Use]
- Caused by: org.apache.catalina.LifecycleException: A child container failed during start
- Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.
- Android 9.0 APP Install Android 4.4 Error: classnotfoundexception
- solve java.util.prefs . backingstoreexception error