Fixing LLDB on Android Studio on M1 Mac

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!

--

--

--

Software Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Receive Rewards Just For Downloading

Setting Up the Working Environment using DevOps. (Production + Testing Environment)

What’s With the Luminaries at Agile2020?

Understanding The Github

Current logo of Github

New simple dashboard to create EC2 instances on AWS

DeepAR is out!

Network Devices

What does your code smell?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pawit Pornkitprasan

Pawit Pornkitprasan

Software Engineer

More from Medium

Building a debugging keyboard for Mendix Studio Pro

Building a debugging keyboard for Mendix Studio Pro

The Window Watcher — A Smarter Office using LoRaWAN

Upgrade all software with one click with Choco and Total Commander

Discover the PandaDoc API with Postman