Fixing LLDB on Android Studio on M1 Mac

Pawit Pornkitprasan
2 min readAug 8, 2021

--

TL;DR

To fix:

Error while starting native debug session: java.lang.RuntimeException: Found broken LLDB configuration

Replace the content of Android Studio.app/Contents/plugins/android-ndk/resources/lldb with the one from the Intel version of Android Studio and everything should work.

Tested on Android Studio 2020.3.1.

Full Story

So I’ve been testing Android Studio on macOS on Apple Silicon (M1) and it works surprisingly well, including the ultra-speedy emulator.

However, there is one problem — the debugger for native code doesn’t work, and it gives the following unhelpful error

Now Launching Native Debug Session
Error while starting native debug session: java.lang.RuntimeException: Found broken LLDB configuration

Unfortunately, Googling doesn’t help and searching for that error message in Android Code Search yields no results.

Looking in the IDE logs (Help → Show Log in Finder → idea.log) reveals the following logs:

2021-08-08 09:42:26,266 [ 960862]   INFO - s.ndk.run.lldb.ConnectLLDBTask - Found LLDB server: "/Users/pawitp/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7583922/Android Studio.app/Contents/plugins/android-ndk/resources/lldb/android/arm64-v8a/lldb-server" 
2021-08-08 09:42:26,267 [ 960863] WARN - s.ndk.run.lldb.ConnectLLDBTask - Error while starting native debug session: java.lang.RuntimeException: Found broken LLDB configuration
java.lang.RuntimeException: Found broken LLDB configuration
at com.android.tools.ndk.run.lldb.AndroidLLDBDriverConfiguration.findFrameworkFile(AndroidLLDBDriverConfiguration.java:139)
at com.android.tools.ndk.run.lldb.AndroidLLDBDriverConfiguration.<init>(AndroidLLDBDriverConfiguration.java:71)
at com.android.tools.ndk.run.lldb.ConnectLLDBTask.newRunParameters(ConnectLLDBTask.java:579)
at com.android.tools.ndk.run.lldb.ConnectLLDBTask.access$300(ConnectLLDBTask.java:101)
at com.android.tools.ndk.run.lldb.ConnectLLDBTask$3.createDebugProcess(ConnectLLDBTask.java:666)
at com.jetbrains.cidr.execution.CidrLauncher.startDebugProcess(CidrLauncher.java:29)
[snip]

At least now I know which class is it coming from, but searching for AndroidLLDBDriverConfiguration on Google doesn’t give me any source code either. Anyway, the code exists in the following file:

Android Studio.app/Contents/plugins/android-ndk/lib/android-ndk.jar

Using JD-GUI to check that class, I’ve found that it’s searching for a file that’s supposed to exist but doesn’t. I’ve tried to copy the entire android-ndk/resources/lldb folder from the Intel build of Android Studio and, thanks to Rosetta 2, it works!

--

--