2011-04-08 61 views
2

我一直在寻找一个简单的方法来调试我的JNI代码,你知道,能够自由跳转到本地代码并返回到java代码。调试混合JNI代码的方法?

我找到的解决方案是过时的或有一些限制。一些需要特定的ndk版本,一些需要特定的Eclipse版本。在这里我的目标是Android 1.6 & 2.2,我使用Eclipse 3.6 Helios和NDK r5b。有混合调试的通用解决方案吗?谢谢。

回答

1

Citate从$NDK/docs/NDK-GDB.html

重要提示:本机调试只能如果满足所有这些条件下工作:

1. Your application is built with the 'ndk-build' script: 

    Building with the legacy "make APP=<name>" method is not 
    supported by ndk-gdb. 

2. Your application is debuggable: 

    In other words, your AndroidManifest.xml has an <application> 
    element that sets the android:debuggable attribute to "true" 

3. You are running your application on Android 2.2 (or higher): 

    ndk-gdb will not work if you try to run your application on 
    previous versions of the system. That does not mean that your 
    application should target the Android 2.2. API level, just 
    that the debugging session should happen on a 2.2+ device or 
    emulator system image. 

所以,你不能使用1.6设备。

如何设置环境来调试jni代码:我用this recipe,它适用于我。