Android Studio Debugger process finished with exit code 127

Viewed 4257

Recently upgraded to Android Studio 4.2.1

I can launch my app successfully but when I try to attach the debugger I get the error in the question title (see screenshot below).

The app just gets stuck on the "Waiting For Debugger" screen.

Everything worked as expected prior to upgrade.

This is the output from the debug log

$ adb shell am start -n "com.*.*/com.*.*.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.*.* | com.*.*.test
Waiting for application to come online: com.*.* | com.*.*.test
Connected to process 9869 on device 'amazon-kfmuwi-G0W0X8089256FRU1'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
W/ActivityThread: Application com.*.* is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
Connecting to com.*.*
Now Launching Native Debug Session
com.intellij.execution.ExecutionFinishedException: Execution finished

Process finished with exit code 0

In logcat I also see

2021-05-19 12:55:32.855 10394-10394/? E/azon.kindle.cm: Not starting debugger since process cannot load the jdwp agent.

I have tried: Restarting Android device Restarting development device Invalidating and Restarting Android Studio Reinstalling Android Studio

My system is running Pop!_OS 20.10

Debug error

5 Answers

I've solved this by installing 'libncurses5' only

sudo apt install libncurses5

Thanks to Max Elkin

I eventually solved this by rolling back to Android Studio 4.1.

I rolled back AS from 4.2 to 4.1.3 which solved the error

In case the accepted answer doesn't help, here's how to find the root cause:

  • Search for the Debug log settings action (via CTRL + SHIFT + A)
  • Set #com.jetbrains.cidr.execution.debugger:trace in the dialog (source)
  • Try run or attach the debbuger
  • Search for the Collect Logs and Diagnostic Data action (via CTRL + SHIFT + A)
  • Inspect the idea.log file inside the zip. It should show why the debugger fails.

For example, I saw this error brains.cidr.execution.debugger - LLDBFrontend: Fatal Python error: config_get_locale_encoding: failed to get the locale encoding: nl_langinfo(CODESET) failed

Which was fixed by setting this in ~/.zshrc (source)

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
Related