Any simple way to log in Android NDK code?

前端 未结 7 2399
無奈伤痛
無奈伤痛 2020-12-02 12:09

I\'m looking for a way to easily debug C code in an Android NDK application using Eclipse. I\'ve read ways to debug the app using gdb or something similar but what I want i

7条回答
  •  被撕碎了的回忆
    2020-12-02 12:36

    ADT 20 includes an NDK plugin that provides support for building and debugging NDK projects in Eclipse. This document describes how to install and use the NDK plugin. Instructions are pretty straightforward and consist of only a few steps.

    This is the simplest solution I found and it worked for me.

    Note: If you are using ADT bundle you only need to install C development tools with install new software (see the screenshot) and you can go to "Using the NDK plugin" part immediately.

    c dev tools install

    Edit: It seems there is an issue with CDT in eclipse juno http://code.google.com/p/android/issues/detail?id=33788 causing eclipse's debugger to be unable to find breakpoints. Workaround I used is to start app in debug mode (not debug as native app but 'regular' debug) and then in command line I went to my project root and typed ndk-gdb (this creates gdb.setup file in obj/local/armeabi folder). After that breakpoints worked as usual.

    In comments related to the issue on the link above they suggest some other workarounds but I didn't try them since they seemed to require more effort than this.

提交回复
热议问题