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

前端 未结 5 2001
野趣味
野趣味 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

    If your native breakpoint still can't get hit after you tried everything AND by any chance your native library had been referenced across multiple AS projects, then there is a simple solution.

    Just rename your native library in setting.gradle and your build.gradle

    Befor:

    //in setting.gradle
    include ":myNativeLib"
    project(":myNativeLib").projectDir = new File("...")
    //in app's build.gradle
    api project(':myNativeLib')
    

    After:

    //in setting.gradle
    include ":myNativeLib2"
    project(":myNativeLib2").projectDir = new File("...")
    //in app's build.gradle
    api project(':myNativeLib2')
    

提交回复
热议问题