'Android Studio App Crash When using "Step Over" and "Step Into"

when I try to debug my app in an emulator, it can stop at a breakpoint, but when I click "Step Out" and "Step into" during debugging, the Android App will simply crash. However, when I try to click "Run to cursor" or "Resume Program" to the next breakpoint, it will be fine.

Android Studio Version: Android Studio Chipmunk | 2021.2.1 Build #AI-212.5712.43.2112.8512546
Gradle Plugin Version: tried both 7.0.4 and 7.2.0
Gradle Version: 7.3.3
Java SDK: tried both openjdk version "11.0.15+10" and the embedded JDK "11.0.12"
The Android App: I tried both a built-in Android Studio sample App and default react native App by simply running npx react-native init AwesomeProject
Android Emulator JDK for the simulator:

  1. Android 8.0 (Oreo) Google APIs Intel x86 Atom_64 System Image
  2. Android 8.0 (Oreo) Google APIs Intel x86 Atom System Image
  3. Android 9.0 (Pie) Google APIs Intel x86 Atom_64 System Image
  4. Android 9.0 (Pie) Google APIs Intel x86 Atom System Image

I have tried the following solutions but none of them works:

  1. Set the Debug type: Dual(Java + Native) in Android Studio
  2. Reinstall the Android Studio, JDK, AVD manager
  3. Not enabling "Automatically perform "Run" when Apply Changes fails" and "Automatically perform "Run" when Apply Code Chagnes fails in Android Studio
  4. Change the targetSdkVersion to 26 and 30 and compileSdkVersion to 26 and 30 and build the App again

I have already refer to the solution provided in the following links, but none of them can solve the issue:
[https://stackoverflow.com/questions/68743574/android-studio-app-crashes-on-step-over]
[https://stackoverflow.com/questions/37495131/debugging-android-studio-causes-app-to-crash-when-stepping-over-to-exit-a-meth]
[https://stackoverflow.com/questions/67243671/android-studio-ide-debugging-step-into-over-crashing-app]

The following solutions work:

  1. Use an emulator with SDK Android 12 (S) Google APIs Intel x86 Atom_64 System Image
  2. When I use the same Android Studio version, source code, JDK and Build Version in my friend's laptop. This issue is not happened. We are both using Windows 10 Home Edition.

However, I really need to do the "Step Out" and "Step into" debugging with Emulator installing Android 8 SDK in my own laptop. May I know if anything I can do to fix the issue?

Detail Error Logs during debugging:

>05/14 23:24:11: Launching 'app' on Nexus 4 API 26.    
>......          
>I/chatty: uid=10078(u0_a78) com.example.myapplication identical 4 lines  
>I/System.out: waiting for debugger to settle...  
>I/System.out: debugger has settled (1361)  
>A/zygote64: jdwp_handler.cc:1221] Check failed: modifier_count < 256 (modifier_count=413, 256=256)   
>A/zygote64: runtime.cc:492] Runtime aborting...  
>A/zygote64: runtime.cc:492] Aborting thread:  
>A/zygote64: runtime.cc:492] "JDWP" prio=5 tid=4 Runnable  
>A/zygote64: runtime.cc:492]   | group="" sCount=0 dsCount=0 flags=0 obj=0x13288f18 self=0x706862014400  
>A/zygote64: runtime.cc:492]   | sysTid=6908 nice=0 cgrp=default sched=0/0 handle=0x7068574904f0  
>A/zygote64: runtime.cc:492]   | state=R schedstat=( 106028929 25880806 595 ) utm=0 stm=10 core=3 HZ=100  
>A/zygote64: runtime.cc:492]   | stack=0x706857396000-0x706857398000 stackSize=1005KB  
>A/zygote64: runtime.cc:492]   | held mutexes= "abort lock" "mutator lock"(shared held)  
>A/zygote64: runtime.cc:492]   native: #00 pc 0000000000435ca5  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+213)  
>A/zygote64: runtime.cc:492]   native: #01 pc 0000000000515b12  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+322)  
>A/zygote64: runtime.cc:492]   native: #02 pc 00000000004fae4c  /system/lib64/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+44)  
>A/zygote64: runtime.cc:492]   native: #03 pc 00000000004fac63  /system/lib64/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+403)  
>A/zygote64: runtime.cc:492]   native: #04 pc 00000000004eb71a  /system/lib64/libart.so (_ZN3art7Runtime5AbortEPKc+154)  
>A/zygote64: runtime.cc:492]   native: #05 pc 00000000004ebfc0  /system/lib64/libart.so (_ZN3art7Runtime7AborterEPKc+16)  
>A/zygote64: runtime.cc:492]   native: #06 pc 00000000005e69e2  /system/lib64/libart.so (_ZN7android4base10LogMessageD1Ev+946)  
>A/zygote64: runtime.cc:492]   native: #07 pc 000000000037dd88  /system/lib64/libart.so (_ZN3art4JDWPL6ER_SetEPNS0_9JdwpStateEPNS0_7RequestEPNS0_9ExpandBufE+1864)  
>A/zygote64: runtime.cc:492]   native: #08 pc 000000000037a0e7  /system/lib64/libart.so (_ZN3art4JDWP9JdwpState14ProcessRequestEPNS0_7RequestEPNS0_9ExpandBufEPb+759)  
>A/zygote64: runtime.cc:492]   native: #09 pc 0000000000380dcf  /system/lib64/libart.so (_ZN3art4JDWP9JdwpState12HandlePacketEv+175)  
>A/zygote64: runtime.cc:492]   native: #10 pc 00000000005d861c  /system/lib64/libart.so (_ZN3art4JDWP12JdwpAdbState15ProcessIncomingEv+1052)  
>A/zygote64: runtime.cc:492]   native: #11 pc 0000000000381700  /system/lib64/libart.so (_ZN3art4JDWP9JdwpState3RunEv+1936)  
>A/zygote64: runtime.cc:492]   native: #12 pc 0000000000380774  /system/lib64/libart.so (_ZN3art4JDWPL15StartJdwpThreadEPv+36)  
>A/zygote64: runtime.cc:492]   native: #13 pc 000000000007706b  /system/lib64/libc.so (_ZL15__pthread_startPv+27)  
>A/zygote64: runtime.cc:492]   native: #14 pc 0000000000028aad  /system/lib64/libc.so (__start_thread+61)  
>A/zygote64: runtime.cc:492]   native: #15 pc 0000000000027515  /system/lib64/libc.so (__bionic_clone+53)  
>A/zygote64: runtime.cc:492]   (no managed stack frames)  
>A/zygote64: runtime.cc:492] Dumping all threads without appropriate locks held: thread list lock  
>A/zygote64: runtime.cc:492] All threads:  
>A/zygote64: runtime.cc:492] DALVIK THREADS (11):  
>A/zygote64: runtime.cc:492] "JDWP" prio=5 tid=4 Runnable  
>A/zygote64: runtime.cc:492]   | group="" sCount=0 dsCount=0 flags=0 obj=0x13288f18 self=0x706862014400  
>A/zygote64: runtime.cc:492]   | sysTid=6908 nice=0 cgrp=default sched=0/0 handle=0x7068574904f0  
>A/zygote64: runtime.cc:492]   | state=R schedstat=( 112874191 26238262 596 ) utm=0 stm=11 core=3 HZ=100  
>A/zygote64: runtime.cc:492]   | stack=0x706857396000-0x706857398000 stackSize=1005KB  
>A/zygote64: runtime.cc:492]   | held mutexes= "abort lock" "mutator lock"(shared held)  
>A/zygote64: runtime.cc:492]   native: #00 pc 0000000000435ca5  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+213)  
>A/zygote64: runtime.cc:492]   native: #01 pc 0000000000515b12  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+322)  
>A/zygote64: runtime.cc:492]   native: #02 pc 000000000052e56e  /system/lib64/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+926)  
>A/zygote64: runtime.cc:492]   native: #03 pc 0000000000526399  /system/lib64/libart.so (_ZN3art10ThreadList13RunCheckpointEPNS_7ClosureES2_+489)  
>A/zygote64: runtime.cc:492]   native: #04 pc 0000000000525ba5  /system/lib64/libart.so (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEb+261)  
>A/zygote64: runtime.cc:492]   native: #05 pc 00000000004fac71  /system/lib64/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+417)  
>A/zygote64: runtime.cc:492]   native: #06 pc 00000000004eb71a  /system/lib64/libart.so (_ZN3art7Runtime5AbortEPKc+154)  
>A/zygote64: runtime.cc:492]   native: #07 pc 00000000004ebfc0  /system/lib64/libart.so (_ZN3art7Runtime7AborterEPKc+16)  
>A/zygote64: runtime.cc:492]   native: #08 pc 00000000005e69e2  /system/lib64/libart.so (_ZN7android4base10LogMessageD1Ev+946)  
>A/zygote64: runtime.cc:492]   native: #09 pc 000000000037dd88  /system/lib64/libart.so (_ZN3art4JDWPL6ER_SetEPNS0_9JdwpStateEPNS0_7RequestEPNS0_9ExpandBufE+1864)  
>A/zygote64: runtime.cc:492]   native: #10 pc 000000000037a0e7  /system/lib64/libart.so (_ZN3art4JDWP9JdwpState14ProcessRequestEPNS0_7RequestEPNS0_9ExpandBufEPb+759)  
>A/zygote64: runtime.cc:492]   native: #11 pc 0000000000380dcf  /system/lib64/libart.so (_ZN3art4JDWP9JdwpState12HandlePacketEv+175)  
>A/zygote64: runtime.cc:492]   native: #12 pc 00000000005d861c  /system/lib64/libart.so (_ZN3art4JDWP12JdwpAdbState15ProcessIncomingEv+1052)  
>A/zygote64: runtime.cc:492]   native: #13 pc 0000000000381700  /system/lib64/libart.so (_ZN3art4JDWP9JdwpState3RunEv+1936)  
>A/zygote64: runtime.cc:492]   native: #14 pc 0000000000380774  /system/lib64/libart.so (_ZN3art4JDWPL15StartJdwpThreadEPv+36)  
>A/zygote64: runtime.cc:492]   native: #15 pc 000000000007706b  /system/lib64/libc.so (_ZL15__pthread_startPv+27)  
>A/zygote64: runtime.cc:492]   native: #16 pc 0000000000028aad  /system/lib64/libc.so (__start_thread+61)  
>A/zygote64: runtime.cc:492]   native: #17 pc 0000000000027515  /system/lib64/libc.so (__bionic_clone+53)  
>A/zygote64: runtime.cc:492]   (no managed stack frames)  
>A/zygote64: runtime.cc:492]   
>A/zygote64: runtime.cc:492] "main" prio=5 tid=1 Suspended  
>A/zygote64: runtime.cc:492]   | group="" sCount=2 dsCount=1 flags=1 obj=0x72ead670 self=0x70686b8bea00  
>A/zygote64: runtime.cc:492]   | sysTid=6892 nice=-10 cgrp=default sched=0/0 handle=0x706870827a08  
>A/zygote64: runtime.cc:492]   | state=S schedstat=( 194421656 41957213 179 ) utm=15 stm=4 core=2 HZ=100  
>A/zygote64: runtime.cc:492]   | stack=0x7ffec0e83000-0x7ffec0e85000 stackSize=8MB  
>A/zygote64: runtime.cc:492]   | held mutexes=  
>A/zygote64: runtime.cc:492]   kernel: futex_wait_queue_me+0xdf/0x130  
>A/zygote64: runtime.cc:492]   kernel: futex_wait+0x113/0x22e  
>A/zygote64: runtime.cc:492]   kernel: do_futex+0xbe/0x825  
>A/zygote64: runtime.cc:492]   kernel: SyS_futex+0xbd/0x124  
>A/zygote64: runtime.cc:492]   kernel: system_call_fastpath+0x12/0x17  
>A/zygote64: runtime.cc:492]   native: #00 pc 00000000000276f6  /system/lib64/libc.so (syscall+22)  
>A/zygote64: runtime.cc:492]   native: #01 pc 000000000014d38e  /system/lib64/libart.so (_ZN3art17ConditionVariable16WaitHoldingLocksEPNS_6ThreadE+110)  
>......  
>A/zygote64: runtime.cc:492]   at com.example.myapplication.MainActivity.onCreate(MainActivity.java:31)  
>A/zygote64: runtime.cc:492]   at android.app.Activity.performCreate(Activity.java:6975)  
>A/zygote64: runtime.cc:492]   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)  
>A/zygote64: runtime.cc:492]   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)  
>A/zygote64: runtime.cc:492]   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)  
>A/zygote64: runtime.cc:492]   at android.app.ActivityThread.-wrap11(ActivityThread.java:-1)  
>A/zygote64: runtime.cc:492]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)  
>A/zygote64: runtime.cc:492]   at android.os.Handler.dispatchMessage(Handler.java:105)  
>A/zygote64: runtime.cc:492]   at android.os.Looper.loop(Looper.java:164)  
>A/zygote64: runtime.cc:492]   at android.app.ActivityThread.main(ActivityThread.java:6541)  
>A/zygote64: runtime.cc:492]   at java.lang.reflect.Method.invoke(Native method)  
>A/zygote64: runtime.cc:492]   at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)  
>A/zygote64: runtime.cc:492]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)  
>A/zygote64: runtime.cc:492]   
>A/zygote64: runtime.cc:492] "Jit thread pool worker thread 0" prio=5 tid=2 Native  
>A/zygote64: runtime.cc:492]   | group="" sCount=1 dsCount=0 flags=1 obj=0x13288e08 self=0x70686200e000  
>A/zygote64: runtime.cc:492]   | sysTid=6904 nice=9 cgrp=default sched=0/0 handle=0x7068625454f0  
>A/zygote64: runtime.cc:492]   | state=S schedstat=( 34515508 4713228 86 ) utm=0 stm=3 core=3 HZ=100  
>A/zygote64: runtime.cc:492]   | stack=0x706862447000-0x706862449000 stackSize=1021KB  
>A/zygote64: runtime.cc:492]   | held mutexes=  
>A/zygote64: runtime.cc:492]   kernel: futex_wait_queue_me+0xdf/0x130  
>A/zygote64: runtime.cc:492]   kernel: futex_wait+0x113/0x22e  
>A/zygote64: runtime.cc:492]   kernel: do_futex+0xbe/0x825  
>A/zygote64: runtime.cc:492]   kernel: SyS_futex+0xbd/0x124  
>A/zygote64: runtime.cc:492]   kernel: system_call_fastpath+0x12/0x17  
>A/zygote64: runtime.cc:492]   native: #00 pc 00000000000276f6  /system/lib64/libc.so (syscall+22)  
>A/zygote64: runtime.cc:492]   native: #01 pc 000000000014d38e  /system/lib64/libart.so (_ZN3art17ConditionVariable16WaitHoldingLocksEPNS_6ThreadE+110)  
>A/zygote64: runtime.cc:492]   native: #02 pc 0000000000530012  /system/lib64/libart.so (_ZN3art10ThreadPool7GetTaskEPNS_6ThreadE+322)  
>A/zygote64: runtime.cc:492]   native: #03 pc 000000000052f4a1  /system/lib64/libart.so (_ZN3art16ThreadPoolWorker3RunEv+97)  
>A/zygote64: runtime.cc:492]   native: #04 pc 000000000052ef53  /system/lib64/libart.so (_ZN3art16ThreadPoolWorker8CallbackEPv+131)  
>A/zygote64: runtime.cc:492]   native: #05 pc 000000000007706b  /system/lib64/libc.so (_ZL15__pthread_startPv+27)  
>A/zygote64: runtime.cc:492]   native: #06 pc 0000000000028aad  /system/lib64/libc.so (__start_thread+61)  
>A/zygote64: runtime.cc:492]   native: #07 pc 0000000000027515  /system/lib64/libc.so (__bionic_clone+53)  
>A/zygote64: runtime.cc:492]   (no managed stack frames)  
>......  
>A/zygote64: runtime.cc:492]   
>A/zygote64: runtime.cc:492] "Profile Saver" prio=5 tid=11 Native  
>A/zygote64: runtime.cc:492]   | group="" sCount=1 dsCount=0 flags=1 obj=0x13289248 self=0x70685f548e00  
>A/zygote64: runtime.cc:492]   | sysTid=7128 nice=9 cgrp=default sched=0/0 handle=0x7068566004f0  
>A/zygote64: runtime.cc:492]   | state=S schedstat=( 2106036 443764 6 ) utm=0 stm=0 core=0 HZ=100  
>A/zygote64: runtime.cc:492]   | stack=0x706856506000-0x706856508000 stackSize=1005KB  
>A/zygote64: runtime.cc:492]   | held mutexes=  
>A/zygote64: runtime.cc:492]   kernel: futex_wait_queue_me+0xdf/0x130  
>A/zygote64: runtime.cc:492]   kernel: futex_wait+0x113/0x22e  
>A/zygote64: runtime.cc:492]   kernel: do_futex+0xbe/0x825  
>A/zygote64: runtime.cc:492]   kernel: SyS_futex+0xbd/0x124  
>A/zygote64: runtime.cc:492]   kernel: system_call_fastpath+0x12/0x17  
>A/zygote64: runtime.cc:492]   native: #00 pc 00000000000276f8  /system/lib64/libc.so (syscall+24)  
>A/zygote64: runtime.cc:492]   native: #01 pc 000000000014d7cc  /system/lib64/libart.so (_ZN3art17ConditionVariable9TimedWaitEPNS_6ThreadEli+140)  
>A/zygote64: runtime.cc:492]   native: #02 pc 00000000003a2378  /system/lib64/libart.so (_ZN3art12ProfileSaver3RunEv+600)  
>A/zygote64: runtime.cc:492]   native: #03 pc 00000000003a45f7  /system/lib64/libart.so (_ZN3art12ProfileSaver21RunProfileSaverThreadEPv+87)  
>A/zygote64: runtime.cc:492]   native: #04 pc 000000000007706b  /system/lib64/libc.so (_ZL15__pthread_startPv+27)  
>A/zygote64: runtime.cc:492]   native: #05 pc 0000000000028aad  /system/lib64/libc.so (__start_thread+61)  
>A/zygote64: runtime.cc:492]   native: #06 pc 0000000000027515  /system/lib64/libc.so (__bionic_clone+53)  
>A/zygote64: runtime.cc:492]   (no managed stack frames)  
>A/zygote64: runtime.cc:492]   
>A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 6908 (JDWP)  
>Disconnected from the target VM, address: 'localhost:52019', transport: 'socket'  

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source