Is it possible to debug C/C++ in Android Studio?

前端 未结 6 1598
时光取名叫无心
时光取名叫无心 2020-12-14 17:04

I\'m writing an Android app that includes C/C++ code that is compiled alongside the Java code. My app is crashing during the execution of the native code.

Is there

6条回答
  •  死守一世寂寞
    2020-12-14 17:57

    [UPDATE]

    As of July 2015, Android Studio DOES support NDK.

    You can learn more about it on this link.


    [OLD] NDK is not yet supported in Android Studio.

    When we have to deal with NDK, the only solution is to use Eclipse.

    EDIT

    We basically keep Eclipse project with NDK feature (map in our case) and Gradle project with other (non-map) features. So everything that has to be done with NDK, we do in Eclipse and then include changes into Gradle project.

    To be more precise, inside directory /src/main/ we created another directory called jniLibs and put the compiled *.so file inside architecture-specific folders (armeabi-v7a, armeabi, x86...). Then in the main class of Gradle project simply added a line

    static {
        System.loadLibrary("OurNDKLibName");
    }
    

    You can add this line only once per project. Maybe I am wrong but we did not have any issues for doing so.

提交回复
热议问题