I'm hitting this issue in Androidstudio 4.1.1 and 4.1.2
Whenever I try to debug the app in dual mode, the app crashes while androidstudio tries to start native debug session and then it fails to connect to the debugger(obviously!). Here's the details from the idea.log:
2021-01-28 22:50:51,845 [ 698412] INFO - idea.run.AndroidProcessHandler - Adding device Pixel_3_API_29_droidx64 [emulator-5554] to monitor for launched app: <app>
2021-01-28 22:50:51,848 [ 698415] INFO - run.AndroidLogcatOutputCapture - startCapture("Pixel_3_API_29_droidx64 [emulator-5554]")
2021-01-28 22:50:51,849 [ 698416] INFO - s.ndk.run.lldb.ConnectLLDBTask - ABIs supported by app: [x86_64]
2021-01-28 22:50:52,645 [ 699212] INFO - s.ndk.run.lldb.ConnectLLDBTask - Launching AndroidNativeAttachConfigurationType:Hybrid native debug session on device: manufacturer=Google, model=Android SDK built for x86_64, API=29, codename=REL, ABIs=[x86_64, x86]
2021-01-28 22:50:52,742 [ 699309] WARN - s.ndk.run.lldb.ConnectLLDBTask - Using run-as to start debug session
2021-01-28 22:50:52,770 [ 699337] INFO - s.ndk.run.lldb.ConnectLLDBTask - ABIs supported by app: [x86_64]
2021-01-28 22:50:52,788 [ 699355] INFO - s.ndk.run.lldb.ConnectLLDBTask - Found LLDB server: "<AndroidStudioFolder>inlldbandroidx86_64lldb-server"
2021-01-28 22:50:52,804 [ 699371] INFO - AndroidLLDBDriverConfiguration - LLDB framework file: <AndroidStudioFolder>inlldbinliblldb.dll
2021-01-28 22:50:52,924 [ 699491] WARN - n.AndroidNativeAppDebugProcess - Could not set up disassembly view. Will not work for this debug session.
2021-01-28 22:50:53,109 [ 699676] WARN - s.ndk.run.lldb.ConnectLLDBTask - Error while starting native debug session: java.lang.NullPointerException
java.lang.NullPointerException
at com.intellij.xdebugger.impl.XDebugSessionImpl.processBreakpoints(XDebugSessionImpl.java:415)
at com.intellij.xdebugger.impl.XDebugSessionImpl.processAllBreakpoints(XDebugSessionImpl.java:569)
at com.intellij.xdebugger.impl.XDebugSessionImpl.initBreakpoints(XDebugSessionImpl.java:312)
at com.intellij.xdebugger.impl.XDebugSessionImpl.init(XDebugSessionImpl.java:280)
at com.intellij.xdebugger.impl.XDebuggerManagerImpl.startSession(XDebuggerManagerImpl.java:267)
at com.intellij.xdebugger.impl.XDebuggerManagerImpl.startSession(XDebuggerManagerImpl.java:219)
at com.jetbrains.cidr.execution.CidrRunner.startDebugSession(CidrRunner.java:75)
at com.android.tools.ndk.run.lldb.ConnectLLDBTask.launchCidrDebugger(ConnectLLDBTask.java:692)
at com.android.tools.ndk.run.lldb.ConnectLLDBTask.launchDebugger(ConnectLLDBTask.java:336)
at com.android.tools.idea.run.tasks.ConnectDebuggerTask.lambda$perform$0(ConnectDebuggerTask.java:90)
at com.intellij.util.ui.UIUtil.lambda$invokeAndWaitIfNeeded$7(UIUtil.java:2356)
at com.intellij.util.ui.EdtInvocationManager.invokeAndWaitIfNeeded(EdtInvocationManager.java:64)
at com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(UIUtil.java:2339)
at com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(UIUtil.java:2356)
at com.android.tools.idea.run.tasks.ConnectDebuggerTask.perform(ConnectDebuggerTask.java:90)
at com.android.tools.ndk.run.attach.NativeAttachState.execute(NativeAttachState.java:96)
at com.android.tools.idea.run.AndroidBaseProgramRunner.doExecute(AndroidBaseProgramRunner.java:62)
at com.intellij.execution.runners.GenericProgramRunner$execute$1.invoke(GenericProgramRunner.kt:20)
at com.intellij.execution.runners.GenericProgramRunner$execute$1.invoke(GenericProgramRunner.kt:13)
at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:147)
at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:60)
at com.intellij.execution.impl.ExecutionManagerImpl$doStartRunProfile$startRunnable$1.run(ExecutionManagerImpl.kt:208)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:201)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:310)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:80)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:128)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:184)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:974)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:847)
at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:741)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
2021-01-28 22:50:53,326 [ 699893] INFO - run.AndroidLogcatOutputCapture - stopCapture("Pixel_3_API_29_droidx64 [emulator-5554]")
2021-01-28 22:50:53,454 [ 700021] INFO - run.AndroidLogcatOutputCapture - stopAll()
2021-01-28 22:50:53,680 [ 700247] INFO - ls.ndk.run.lldb.SessionStarter - Pushing files to device
2021-01-28 22:50:53,805 [ 700372] INFO - ls.ndk.run.lldb.SessionStarter - Pushing to the device: <AndroidStudioFolder>inlldbandroidx86_64lldb-server => /data/local/tmp/lldb-server
2021-01-28 22:50:54,014 [ 700581] INFO - ls.ndk.run.lldb.SessionStarter - Pushing to the device: <AndroidStudioFolder>inlldbandroidstart_lldb_server.sh => /data/local/tmp/start_lldb_server.sh
2021-01-28 22:50:54,040 [ 700607] INFO - ndk.run.lldb.AndroidLLDBDriver - Loading driver
2021-01-28 22:50:54,041 [ 700608] INFO - ndk.run.lldb.AndroidLLDBDriver - Loading startup script: <AndroidStudioFolder>inlldbsharedstl_printersload_script
2021-01-28 22:50:54,081 [ 700648] INFO - ndk.run.lldb.AndroidLLDBDriver - Loading startup script: <AndroidStudioFolder>inlldbsharedjobject_printersjstring_reader.py
2021-01-28 22:50:54,087 [ 700654] INFO - ndk.run.lldb.AndroidLLDBDriver - Startup command: "settings set auto-confirm true"
2021-01-28 22:50:54,088 [ 700655] INFO - ndk.run.lldb.AndroidLLDBDriver - Startup command: "settings set plugin.symbol-file.dwarf.comp-dir-symlink-paths /proc/self/cwd"
2021-01-28 22:50:54,088 [ 700655] INFO - ndk.run.lldb.AndroidLLDBDriver - Startup command: "settings set plugin.jit-loader.gdb.enable-jit-breakpoint false"
2021-01-28 22:50:54,113 [ 700680] INFO - n.lldb.ShellSessionStarterImpl - Copying to app folder: /data/local/tmp/lldb-server => /data/data/<app>/lldb/bin/lldb-server
2021-01-28 22:50:54,113 [ 700680] INFO - n.lldb.ShellSessionStarterImpl - Command: cat /data/local/tmp/lldb-server | run-as <app> sh -c 'cat > /data/data/<app>/lldb/bin/lldb-server && chmod 700 /data/data/<app>/lldb/bin/lldb-server'
2021-01-28 22:50:54,128 [ 700695] INFO - n.lldb.ShellSessionStarterImpl - Copying to app folder: /data/local/tmp/start_lldb_server.sh => /data/data/<app>/lldb/bin/start_lldb_server.sh
2021-01-28 22:50:54,128 [ 700695] INFO - n.lldb.ShellSessionStarterImpl - Command: cat /data/local/tmp/start_lldb_server.sh | run-as <app> sh -c 'cat > /data/data/<app>/lldb/bin/start_lldb_server.sh && chmod 700 /data/data/<app>/lldb/bin/start_lldb_server.sh'
2021-01-28 22:50:54,146 [ 700713] INFO - n.lldb.ShellSessionStarterImpl - Starting LLDB server : /data/data/<app>/lldb/bin/start_lldb_server.sh /data/data/<app>/lldb unix-abstract /<app>-0 platform-1611854452789.sock "lldb process:gdb-remote packets"
2021-01-28 22:50:54,146 [ 700713] INFO - ndk.run.lldb.AndroidLLDBDriver - Connecting to LLDB server: unix-abstract-connect://[emulator-5554]/<app>-0/platform-1611854452789.sock
2021-01-28 22:50:54,159 [ 700726] INFO - n.lldb.ShellSessionStarterImpl - LLDB server has exited:
2021-01-28 22:51:02,289 [ 708856] WARN - ndk.run.lldb.AndroidLLDBDriver - Failed to connect platform (attempt 1 of 10) - retrying. Error was: failed to get reply to handshake packet
2021-01-28 22:51:02,790 [ 709357] INFO - ndk.run.lldb.AndroidLLDBDriver - Connecting to LLDB server: unix-abstract-connect://[emulator-5554]/<app>-0/platform-1611854452789.sock
2021-01-28 22:51:09,792 [ 716359] INFO - j.ide.actions.RevealFileAction - Exit code 1
2021-01-28 22:51:10,960 [ 717527] WARN - ndk.run.lldb.AndroidLLDBDriver - Failed to connect platform (attempt 2 of 10) - retrying. Error was: failed to get reply to handshake packet
2021-01-28 22:51:11,460 [ 718027] INFO - ndk.run.lldb.AndroidLLDBDriver - Connecting to LLDB server: unix-abstract-connect://[emulator-5554]/<app>-0/platform-1611854452789.sock
2021-01-28 22:51:19,656 [ 726223] WARN - ndk.run.lldb.AndroidLLDBDriver - Failed to connect platform (attempt 3 of 10) - retrying. Error was: failed to get reply to handshake packet
2021-01-28 22:51:20,157 [ 726724] INFO - ndk.run.lldb.AndroidLLDBDriver - Connecting to LLDB server: unix-abstract-connect://[emulator-5554]/<app>-0/platform-1611854452789.sock
2021-01-28 22:51:28,299 [ 734866] WARN - ndk.run.lldb.AndroidLLDBDriver - Failed to connect platform (attempt 4 of 10) - retrying. Error was: failed to get reply to handshake packet
2021-01-28 22:51:28,799 [ 735366] INFO - ndk.run.lldb.AndroidLLDBDriver - Connecting to LLDB server: unix-abstract-connect://[emulator-5554]/<app>-0/platform-1611854452789.sock
2021-01-28 22:51:36,990 [ 743557] WARN - ndk.run.lldb.AndroidLLDBDriver - Failed to connect platform (attempt 5 of 10) - retrying. Error was: failed to get reply to handshake packet
2021-01-28 22:51:37,491 [ 744058] INFO - ndk.run.lldb.AndroidLLDBDriver - Connecting to LLDB server: unix-abstract-connect://[emulator-5554]/<app>-0/platform-1611854452789.sock
2021-01-28 22:51:45,673 [ 752240] WARN - ndk.run.lldb.AndroidLLDBDriver - Failed to connect platform (attempt 6 of 10) - retrying. Error was: failed to get reply to handshake packet
2021-01-28 22:51:46,174 [ 752741] INFO - ndk.run.lldb.AndroidLLDBDriver - Connecting to LLDB server: unix-ab
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…