How to get breakpoint in NDK native code and debug native code in Android Studio?

前端 未结 5 1996
野趣味
野趣味 2020-12-15 05:55

I am developing android app using NDK. I have two projects. One is for my native library which uses NDK and generates .so file.

I am using Android Studio but disabli

5条回答
  •  旧巷少年郎
    2020-12-15 06:00

    Android Studio 1.3+ supports native debugging.

    To set it up, follow these steps:

    1. Modify your gradle-wrapper.properties, local.properties, and both build.gradle files as shown in this guide
    2. Sync gradle
    3. Create and select new build configuration:

      Click on drop down next to run button) -> Edit configurations, click plus sign, choose Android Native, fill in options on the right (I used LLDB in native debugger tab), and you should be set.

    4. Set breakpoints in C++

    5. Hit debug button and be patient (sometimes the debugger takes a while)

    I have been able to debug native code under Lubuntu 14.04 with Android Studio 1.3 (stable channel). Although others have supposedly been successful under Windows, I haven't been able to debug natively in Windows 8.1 (I have tried with Android Studio 1.3, 1.3.2, and 1.4 preview 3).

    Update Android Studio 1.4 Beta just came out. I tested it and was able to debug natively on Windows 8.1.

提交回复
热议问题