Debugging native libraries for Android OS

前端 未结 2 1548
太阳男子
太阳男子 2020-12-09 00:07

I am to create a shared library for Android OS. Although I have done some Android apps in Eclipse I decided to start my native development with Visual Studio and vs-Android

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-09 00:54

    The steps I take to be able to debug using ndk-gdb

    To build

    Set the -g compiler flag in jnk/Android.mk to build the gdb-server

    LOCAL_CFLAGS := -g
    

    Build the native lib for debugging NDK_DEBUG=1

    ndk-build NDK_DEBUG=1
    

    Set the application debuggable in the manifest.

    android:debuggable=true
    

    Open cygwin and cd to the project path. Set the path to adb.

    export PATH=$PATH:/path_to_android_sdk/platform-tools
    

    And then start gdb

    ndk-gdb --verbose --adb=adb.exe
    

    You will have to type continue when you have connected to the gdb-server

提交回复
热议问题