Andrew McFaul
Andrew McFaul

Reputation: 203

Android Studio Debugger process finished with exit code 127

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

Upvotes: 13

Views: 7594

Answers (5)

Asapha
Asapha

Reputation: 672

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"

Upvotes: 0

Max Elkin
Max Elkin

Reputation: 984

I've solved that by installing 'libncurses5' and 'ia32-libs' packages

This is a known issue and is provided on the android developer's official page. Here is the link https://developer.android.com/studio/known-issues?hl=de#native_debugger_crashes_with_debugger_process_finished_with_exit_code_127

It turns out it's a Linux-specific issue and is because Linux uses upgraded 'libncurses6' and android studio uses 'libncurses5' required to run the debugger.

Upvotes: 34

Asfand
Asfand

Reputation: 81

I've solved this by installing 'libncurses5' only

sudo apt install libncurses5

Thanks to Max Elkin

Upvotes: 7

Ken Kihanya
Ken Kihanya

Reputation: 11

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

Upvotes: 0

Andrew McFaul
Andrew McFaul

Reputation: 203

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

Upvotes: 0

Related Questions