13

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

1
  • 2
    same thing happening to me in 4.2 and 4.2.1
    – alexm
    May 19, 2021 at 13:41

5 Answers 5

34

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.

9
  • 20
    Great, this solved it for me as well: sudo apt install libncurses5
    – ffurrer
    May 31, 2021 at 14:43
  • 5
    Yep. installing libncurses5 fixes it for me too May 31, 2021 at 19:38
  • 2
    In this case, for Arch linux is the package ncurses5-compat-libs Jun 16, 2021 at 22:26
  • Why does this work? Please add context so people don't just sudo install things that may be unrelated to their issue.
    – topher217
    Jul 6, 2021 at 3:52
  • As per the Android Known Issues documentation: "This error occurs on Linux-based platforms when starting the native debugger. It indicates that one of the libraries required by the native debugger is not installed on the local system. The name of the missing library may be already printed in the idea.log file. .... Typically, the missing library is ncurses5 as some recent Linux distributions have already upgraded to ncurses6." - link here Jul 13, 2021 at 17:41
6

I've solved this by installing 'libncurses5' only

sudo apt install libncurses5

Thanks to Max Elkin

1
  • Thanks that is all I had to do Dec 31, 2021 at 23:32
0

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

4
  • yes, same here, but the same thing is happening with Artcic Fox, so that is a short term answer
    – alexm
    May 19, 2021 at 22:11
  • are you using Ubuntu? in Windows and MAC works fine, it seems the problem is the adb being killed by a another process, I cannot get rid off, until I close Android Studio and do an adb reconnect. but basically this bugs the entire connection of adb with a device while Android Studio is running.
    – alexm
    May 19, 2021 at 22:15
  • @alexm Yes, I am using Pop! OS which is built on Ubuntu. I suspected something similar but I did a simple ps aux | grep adb command and couldn't see any evidence that adb was being killed. May 20, 2021 at 14:05
  • I'd like to confirm that I get this issue on ubuntu May 23, 2021 at 14:31
0

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

0

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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.