Native Debugging with Android Studio
This section introduces debugging our sample native apps in Android Studio.
The default configurations created during project import only support Java debugging.
Select Edit Configurations… in the Configurations drop-down menu in the Android Studio toolbar.

Create a new Android App configuration as show below:

In the General tab of the Run/Debug Configuration dialog box, give the configuration a name and select a module.

In the Debugger tab of the Run/Debug Configuration dialog box, change the Debug type to Native, and add symbol paths:

Note that ndk-build
places stripped libraries inside the libs/
directory. You must point the symbol search paths at the obj/local/<arch>
directory. This is also not a recursive search path, so you must set the full path to the obj/local/armeabi-v7a
directory.

If you experience an application crash at AInputQueue_preDispatchEvent
with SIGILL (illegal instruction)
, there is a workaround available by disabling the SIGILL handler in LLDB. Follow these instructions to do so:
- Open the application in Android Studio.
- Open Run > Edit Configurations.
- On the Run/Debug Configurations window, make sure your app is selected in the left pane, and click the Debugger tab in the right pane.
- On the Debugger tab, click the LLDB Post Attach Commands tab below.
- Click the + to the right, add the following command, and press Enter:
process handle --pass true --stop false --notify true SIGILL
- Click OK to apply the change.