的Andr​​oid NDK的应用程序不能打任何断点 [英] Android NDK app not able to hit any breakpoint

查看:307
本文介绍了的Andr​​oid NDK的应用程序不能打任何断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 https://www.youtube.com/watch? V = kjsC-lKUgM8 教程尝试调试一个简单的NDK的应用程序我所做的一切,因为它是在视频中,除了:

  1. 在我的OS X 10.9.3而不是Windows。
  2. 我不使用机器人:可调试=真正的(原因日食认为这是错误)在AndroidManifest.xml中,而不是我设置距离NDK路径 preferences-> Android-> NDK 项目属性 - > C / C ++编译选中使用默认的编译命令,并设置有 NDK-建立NDK_DEBUG = 1 APP_OPTIM =调试
  3. 我不使用 x86模拟器,但三星二重奏小号装置与的Andr​​oid 4.0 0.4

但是,用在视频中没有breakpoiin被打在我的情况。我想调试一个简单的NDK测试项目已经是第4天。调查了很多材料:

  1. 在Android原生开发套件食谱
  2. 在论坛和教程的一堆
  3. 视频

但不能打一个该死的断点。请帮助,如果你能做到这一点永远。

解决方案

下面是一个教程中,我写了我们内部的Andr​​oid开发团队的摘录。其中大部分是从这个博客来源: HTTP://mhandroid.word$p$pss.com/

重要提示:

  1. 在我使用的是Linux(Ubuntu的12.04)的环境,我的机器人的工作。
  2. 我用了ADT包为Linux,共筑:v22.2.1-833290(的Eclipse IDE +附加功能)
  3. 在这些步骤进行调试从Java活动到JNI共享对象。
  4. 在我创建的测试项目本教程将不被贴在这里,虽然引用这些项目是present在下面的说明。你需要一个现有的Andr​​oid应用程序项目,以及正在被调用你的Java code JNI的共享对象。

项目设置

  1. 启用调试。
      

    打开AndroidManifest.xml中,选择应用程序选项卡,将可调试=真正的。这将使即使它是在用户模式下运行的设备上运行的应用程序可调试。

  2.   
  3. 生成本地资源。从终端,进入项目目录,然后输入:

      NDK建造-B
     

    您应该看到下面的输出:

      

    GDBSERVER:[臂的Linux androideabi-4.4.3]库/ armeabi / gdbserver的
      Gdbsetup:库/ armeabi / gdb.setup
      ++编译大拇指:DebuggingTestJNI< = com_sample_test_DebuggingTestActivity.cpp   STATICLIBRARY:的libstdc ++一个
      SharedLibrary:libDebuggingTestJNI.so
      安装:libDebuggingTestJNI.so =>​​库/ armeabi / libDebuggingTestJNI.so

  4. 清理项目。在Eclipse菜单条中选择项目→清洁。这是很好的完成你改变/构建您的本机资源这一步随时随地。此步骤可确保Eclipse将重建你的apk文件。

本机调试设置

  1. 创建Java调试配置。:我们需要创建一个调试配置,步入Java源$ C ​​$ C。

      

        
    • 在Eclipse工具栏,你会看到一个绿色的错误。点击小箭头旁边的错误,然后选择调试配置...。
    •   
    • 双击左边的树形结构Android应用程序。这将创造一个新的Andr​​oid应用程序调试配置的模板。
    •   
    • 在名称:字段中,将其命名为DebuggingTest的Java调试,以确保你知道这个配置专门适用于DebuggingTest项目,并针对您的Java源代码
    • 。   
    • 在项目,点击浏览按钮,选择DebuggingTest
    • 。   
    • 单击应用保存更改。
    •   
    • 单击关闭。
    •   
    • 在Eclipse工具栏,点击小箭头旁边的错误,然后选择整理收藏夹...。
    •   
    • 单击添加...
    •   
    • 选择DebuggingTest的Java调试,然后单击确定。

           
          

      您新的调试配置现在已经创建并添加到您的收藏夹。您可以通过单击旁边的错误工具栏中的小箭头访问您的收藏夹。 DebuggingTest的Java调试应该在列表的顶部。

    •     

      
  2. 运行NDK-gdb调试程序。

      
        
    • 在Eclipse工具栏,点击小箭头旁边的错误,然后选择DebuggingTest的Java调试。这将部署和安装DebuggingTest.apk到您连接的Andr​​oid设备,并启动调试器。
    •   
    • 导航到DebuggingTest项目目录在你的终端,输入以下内容:

           

      NDK-gdb的

    •   
         

    如果该命令成功,您应该看到以下内容:

         
        

    GNU GDB 6.6     版权所有(C)2006自由软件基金会     GDB是自由软件,受GNU通用公共许可证,而你     欢迎改变和/或在一定条件下散发的份。     键入显示复​​制看到了条件。     绝对没有任何保修GDB。类型显示保修的细节。     这GDB被配置为主机= x86_64的Linux的GNU的--target =臂精灵的Linux。     (发现没有调试符号)     ......

      
         

    如果您忘记开始调试应用程序之前这一步,你会得到如下:

         
        

    错误:无法提取物对设备/仿真器应用程序的PID。       你确定该应用程序已经启动?       考虑使用--start或--launch =如果不。     如果你的Andr​​oid.mk文件的格式不正确或者包含$(信息)块,你会得到如下:     CP:目标 ./ OBJ /本地/ armeabi / gdb.setup'是不是一个目录     /主页/开发/ NDK / NDK-gdb的:639:无法创建启动DebuggingTest / JNI / Android.mk     结束DebuggingTest / JNI / Android.mk     ./obj/local/armeabi/gdb.setup:目录不存在     /主页/开发/ NDK / NDK-gdb的:640:无法创建启动DebuggingTest / JNI / Android.mk     结束DebuggingTest / JNI / Android.mk     ./obj/local/armeabi/gdb.setup:目录不存在     开始:无效选项:-x     尝试启动--help以获取更多信息。

      
         

    如果NDK-gdb的已经在运行,你会得到如下:

         
        

    错误:另一个调试会话运行,请使用--force杀死它

    。   

    继续之前解决你的错误。 NDK-gdb的必须成功运行。

    运行 NDK-gdb的不仅确保我们,我们正在做的一切权利,到目前为止,但也创造了 app_process gdb.setup libc.so 在OBJ /本地/ armeabi /我们的项目的子目录中的文件。这些文件将需要在后续步骤中。

  3. 停止调试。

      
        
    • 在您的终端,按CTRL + Z停止NDK-gdb调试程序。
    •   
    • 在Eclipse中,选择运行 - >终止
    • 。   
  4. 创建C / C ++调试配置。我们需要创建调试配置,步入C / C ++源$ C ​​$ C。

      
        
    • 在Eclipse ,点击小箭头旁边的错误,然后选择调试配置...。
    •   
    • 双击C / C ++应用程序,在左边的树形结构。这将创建一个模板,一个新的C / C ++应用程序调试配置。
    •   
    • 在名称:字段中,将其命名为DebuggingTest C和CPP调试,以确保你知道这个配置专门适用于DebuggingTest项目,并针对您的C / C ++源代码
    • 。   
    • 在主选项卡:   
          
      • 单击浏览...在C / C ++应用程序:字段中。   导航到/家庭/测试/测试/ DebuggingTest / OBJ /本地/ armeabi / app_process,然后单击确定。
      •   
      • 单击浏览...项目:字段
      •   
      • 选择DebuggingTest,然后单击确定。
      •   
      • 选中禁用自动生成复选框。
      •   
      • 在表单,你会看到底部的使用GDB(DSF)... - 选择其他...。 preSS选择其他...按钮。
      •   
      • 在弹出对话框中,选中使用配置特定的设置对话框。
      •   
      • 在列表和preSS选择标准创建进程启动器,OK。
      •   
    •   
    • 在调试选项卡:   
          
      • 单击组合框上的调试器:字段,然后选择gdbserver的
      •   
      • 取消选中在启动时停止在:框中
      •   
    •   
    • 在主子选项卡:   
          
      • 点击GDB调试器:浏览...。字段
      •   
      • 导航, "/home/Dev/ndk/toolchains/arm-linux-androideabi-4.4.3/$p$pbuilt/linux-x86/bin/arm-linux-androideabi-gdb"并单击确定。 此调试器一起发行了Android NDK
      •   
      • 在GDB命令文件:字段中,键入/home/Test/testing/DebuggingTest/obj/local/armeabi/gdb2.setup。该gdb2.setup文件不存在,但我们将尽快创建它。
      •   
      • 选中使用完整的文件路径设置断点对话框。
      •   
    •   
    • 在连接子选项卡:   
          
      • 设置类型:为TCP
      •   
      • 设置端口号:到5039
      •   
      • 单击应用保存更改。
      •   
    •   
    • 单击关闭
    •   
    • 在Eclipse工具栏,点击小箭头旁边的错误,然后选择整理收藏夹...。
    •   
    • 单击添加...
    •   
    • 选择DebuggingTest C和CPP调试,然后单击确定。
    •   

    您新的调试配置现在已经创建并添加到您的收藏夹。您可以通过单击旁边的错误工具栏中的小箭头访问您的收藏夹。 DebuggingTest C和CPP调试应该在列表的顶部。

  5. 创建gdb2.setup Eclipse不喜欢瞄准遥控:5039。在gdb安装文件中的行,因为它要在内部输入此命令(这就是为什么你配置的端口在previous步5039)。因为gdb.setup文件由NDK脚本重建,你必须把它复制到gdb2.setup并指出Eclipse来的gdb2.setup文件(这是我们在previous步一样)。

      
        
    • 在文件资源管理器,定位到/家庭/测试/测试/ DebuggingTest / OBJ /本地/ armeabi /".
    •   
    • 复制gdb.setup文件,然后将其粘贴到同一文件夹中。结果应该是一个名为广发行(复印件).setup文件。
    •   
    • 重命名广发行(复印件).setup到gdb2.setup。
    •   
    • 双击该文件。
    • 开启gdb2.setup   
    • 替换为设置solib-搜索路径为/ home /测试/测试/ DebuggingTest / OBJ /本地/ armeabi。
    • 设置solib搜索路径./obj/local/armeabi   
    • 替换的文件./obj/local/armeabi/app_process与文件/ home /测试/测试/ DebuggingTest / OBJ /本地/ armeabi / app_process。
    •   
    • 删除读取行瞄准遥控:5039
    • 。   
    • 保存并关闭文件。
    •   
  6. 创建NDK-gdb的月食。最后一个Eclipse的看家项目。 Eclipse将运行gdb的二进制文件本身,所以我们要删除GDB从NDK-gdb的执行。我们会做另一个复制粘贴,重命名保存原始内容。

      
        
    • 在文件资源管理器,定位到/家/开发/ NDK。
    •   
    • 复制NDK-gdb的文件,然后将其粘贴到同一文件夹中。结果应该是一个名为NDK-gdb的(复制)文件。
    •   
    • 重命名NDK-gdb的(副本),以NDK-gdb的月食。
    •   
    • 开启NDK-gdb的月食做一个右键 - >打开使用其他应用程序...
    •   
    • 从应用程序列表中选择文本编辑器
    •   
    • 在该文件中,找到读取的行$ GDBCLIENT -x native_path $ GDBSETUP (可能在最底层),并把它注释掉由prefixing它以#字符。
    •   
    • 保存并关闭文件。
    •   

    当调试的Eclipse IDE 在原始的来源,我们将使用 NDK-gdb的月食而不是 NDK-gdb的

调试/步入code

  1. 步骤到Java code!

      
        
    • 将断点在DebuggingTestActivity.java文件在第20行(的System.out.println(世界,你好!))。
    •   
    • 将在主活动断点之前的任何电话接入本地code制成。的onCreate()一般是这样做的最好的地方。
    •   
    • 点击旁边的bug的小箭头并选择DebuggingTest的Java调试开始在调试模式下DebuggingTest应用程序。
    •   
    • 您会看到标在屏幕上弹出确认透视图切换。 preSS是的,如果你想它切换到Debug透视图。我建议这样做。
    •   
    • 在这一点上,你应该打你设置的断点。
    •   

    警告:的断点,我们刚打坐在OnCreate函数内。该函数将被调用毕竟静态调用LoadLibrary已吁请。注意OnCreate函数那外面有一个的System.loadLibrary(DebuggingTestJNI)的静态块的内部。这LoadLibrary调用将执行我们进入我们的onCreate功能之前,确保我们的本土符号的时候,我们打我们的初步断点加载。至关重要的是,我们在继续之前停止在断点处!

  2. 步骤到C / C ++ code!

      

        
    • 在您的终端,导航到DebuggingTest目录,键入以下命令:

           
          

      NDK-gdb的月食< - 请记住,我们回到步骤创建该文件6

    •     
    • 如果成功,该命令就完成没有任何反应。
    •     
    • 回到Eclipse,并通过点击小箭头旁边的错误,然后选择DebuggingTest C和CPP调试运行您的C / C ++调试器
    •     
    • 注意::当我这样做,我看到几十个在我的Eclipse控制台中的错误,但事情似乎仍然工作...
    •     
    • 切换回Java透视图。
    •     
    • 单击双箭头在Eclipse窗口的右侧右上角并选择Java。
    •     
    • 开启DebuggingTest / JNI / com_sample_test_DebuggingTestActivity.cpp
    •     
    • 设置在第一JNI函数,将通过您的主要活动被称为一个断点。
    •     
    • 单击运行 - >恢复(F8)
    •     
    • 您将再次得到透视图切换消息,可以随意切换到Debug透视图。
    •     

      

您应该只打我们刚刚成立的本土code断点!

恭喜!

在这一点上,你应该能够把你学到的东西,并使其适应你可能有现有项目。

I am using https://www.youtube.com/watch?v=kjsC-lKUgM8 tutorial to try to debug a simple NDK app. I have done everything as it is in the video except:

  1. I am on OS X 10.9.3 instead of Windows.
  2. I don't use android:debuggable=true(cause eclipse considers it as error) in AndroidManifest.xml instead I have set the NDK path from Preferences->Android->NDK and in Project Properties -> C/C++ Build unchecked Use default build command and set there ndk-build NDK_DEBUG=1 APP_OPTIM=debug.
  3. I don't use x86 emulator but Samsung Duos S device with Android 4.0.4

But the breakpoiin that is used in the video in not being hit in my case. I am trying to debug a simple NDK test project already the 4th day. Have investigated lots of material:

  1. Android Native Development Kit Cookbook
  2. Bunch of forums and tutorials
  3. Videos

But can not hit a single damn breakpoint. Please help if you could do this ever.

解决方案

The following is an excerpt from an tutorial I wrote for our internal Android development team. The bulk of which was derived from this blog: http://mhandroid.wordpress.com/

Important notes:

  1. I use a Linux (Ubuntu 12.04) environment for my Android work.
  2. I used the ADT Bundle for Linux, Build: v22.2.1-833290 (Eclipse IDE + Extras)
  3. These steps are for debugging from a Java Activity into a JNI shared object.
  4. I created test projects for this tutorial which won't be posted here, though references to those projects are present in the instructions that follow. You'll need an existing Android Application Project as well as a JNI shared object that is being called by your Java code.

Project Setup

  1. Enable Debugging.

    Open AndroidManifest.xml, select the Application tab, and set Debuggable=true. This will make the application debuggable even when it's running on a device that's running in user mode.

  2. Build the Native Sources. From the Terminal, enter the project directory and enter:

    ndk-build -B
    

    You should see the following output:

    Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
    Gdbsetup : libs/armeabi/gdb.setup
    Compile++ thumb : DebuggingTestJNI <= com_sample_test_DebuggingTestActivity.cpp StaticLibrary : libstdc++.a
    SharedLibrary : libDebuggingTestJNI.so
    Install : libDebuggingTestJNI.so => libs/armeabi/libDebuggingTestJNI.so

  3. Clean the Project. In the Eclipse menu strip, select Project→Clean. It is good to perform this step anytime you change/build your native sources. This step ensures that Eclipse will rebuild your .apk.

Native Debug Setup

  1. Create Java Debug Configuration. We need to create a debug configuration for stepping into Java source code.

    • In the Eclipse toolbar, you'll see a green bug. Click the little arrow next to the bug and select "Debug Configurations...".
    • Double-click "Android Application" in the tree structure on the left. This will create a template for a new Android Application Debug Configuration.
    • In the "Name:" field, name it "DebuggingTest Java Debug" to make sure you know this Configuration applies specifically to the DebuggingTest project, and targets your Java source.
    • Under "Project:", click the "Browse..." button and select DebuggingTest.
    • Click "Apply" to save your changes.
    • Click "Close".
    • In the Eclipse toolbar, click the little arrow next to the bug and select "Organize Favorites...".
    • Click "Add..."
    • Select "DebuggingTest Java Debug" and click "OK".

      Your new debug configuration has now been created and added to your favorites. You can access your favorites by clicking the little arrow next to the bug in the toolbar. "DebuggingTest Java Debug" should be at the top of the list.

  2. Run ndk-gdb.

    • In the Eclipse toolbar, click the little arrow next to the bug and select "DebuggingTest Java Debug". This will deploy and install the DebuggingTest.apk to your connected Android device and start the debugger.
    • Navigate to the DebuggingTest project directory in your Terminal and type the following:

      ndk-gdb

    If the command succeeds, you should see the following:

    GNU gdb 6.6 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=x86_64-linux-gnu --target=arm-elf-linux". (no debugging symbols found) ...

    If you forgot to start debugging the application before this step, you get the following:

    ERROR: Could not extract PID of application on device/emulator. Are you sure the application is already started? Consider using --start or --launch= if not. If your Android.mk file is malformed or contains $(info) blocks, you get the following: cp: target ./obj/local/armeabi/gdb.setup' is not a directory /home/Dev/NDK/ndk-gdb: 639: cannot create start DebuggingTest/jni/Android.mk end DebuggingTest/jni/Android.mk ./obj/local/armeabi/gdb.setup: Directory nonexistent /home/Dev/NDK/ndk-gdb: 640: cannot create start DebuggingTest/jni/Android.mk end DebuggingTest/jni/Android.mk ./obj/local/armeabi/gdb.setup: Directory nonexistent start: invalid option: -x Trystart --help' for more information.

    If ndk-gdb is already running, you get the following:

    ERROR: Another debug session running, Use --force to kill it.

    Resolve your ERRORs before continuing. ndk-gdb MUST run successfully.

    Running ndk-gdb does not only ensure us that we are doing everything right so far, but also creates app_process, gdb.setup and libc.so files in the obj/local/armeabi/ sub-directory of our project. Those files will be needed in later steps.

  3. Stop Debugging.

    • In your Terminal, type CTRL+Z to stop ndk-gdb.
    • In Eclipse, select Run-->Terminate.

  4. Create C/C++ Debug Configuration. We need to create a debug configuration for stepping into C/C++ source code.

    • In Eclipse, click the little arrow next to the bug and select "Debug Configurations...".
    • Double-click "C/C++ Application" in the tree structure on the left. This will create a template for a new C/C++ Application Debug Configuration.
    • In the "Name:" field, name it "DebuggingTest C and CPP Debug" to make sure you know this Configuration applies specifically to the DebuggingTest project, and targets your C/C++ source.
    • In the "Main" tab:
      • Click "Browse..." on the "C/C++ Application:" field. Navigate to "/home/Test/testing/DebuggingTest/obj/local/armeabi/app_process" and click "OK".
      • Click "Browse..." on the "Project:" field.
      • Select "DebuggingTest" and click "OK".
      • Check the "Disable auto build" box.
      • At the bottom of the form, you'll see "Using GDB (DSF) ... - Select other...". Press the "Select other..." button.
      • In the pop-up, check the "Use configuration specific settings" box.
      • Select "Standard Create Process Launcher" in the list and press "OK".
    • In the "Debugger" tab:
      • Click the combo-box on the "Debugger:" field and select "gdbserver".
      • Uncheck the "Stop on startup at:" box.
    • In the "Main" sub-tab:
      • Click "Browse..." on the "GDB debugger:" field.
      • Navigate to "/home/Dev/ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gdb" and click "OK". This debugger is distributed with the Android NDK.
      • In the "GDB command file:" field, type "/home/Test/testing/DebuggingTest/obj/local/armeabi/gdb2.setup". The gdb2.setup file does not exist yet, but we'll create it shortly.
      • Check the "Use full file path to set breakpoints" box.
    • In the "Connection" sub-tab:
      • Set "Type:" to TCP
      • Set "Port number:" to 5039
      • Click "Apply" to save your changes.
    • Click "Close"
    • In the Eclipse toolbar, click the little arrow next to the bug and select "Organize Favorites...".
    • Click "Add..."
    • Select "DebuggingTest C and CPP Debug" and click "OK".

    Your new debug configuration has now been created and added to your favorites. You can access your favorites by clicking the little arrow next to the bug in the toolbar. "DebuggingTest C and CPP Debug" should be at the top of the list.

  5. Create gdb2.setup. Eclipse doesn't like the "target remote :5039" line in gdb setup file because it wants to enter this command internally (that is why you configured port 5039 in the previous step). Because the gdb.setup file is recreated by the NDK scripts, you have to copy it to the gdb2.setup and point Eclipse to the gdb2.setup file (which we did in the previous step).

    • In your File Explorer, navigate to "/home/Test/testing/DebuggingTest/obj/local/armeabi/".
    • Copy the "gdb.setup" file and then paste it into the same folder. The result should be a file named "gdb (copy).setup".
    • Rename "gdb (copy).setup" to "gdb2.setup".
    • Open gdb2.setup by double-clicking the file.
    • Replace "set solib-search-path ./obj/local/armeabi" with "set solib-search-path /home/Test/testing/DebuggingTest/obj/local/armeabi".
    • Replace "file ./obj/local/armeabi/app_process" with "file /home/Test/testing/DebuggingTest/obj/local/armeabi/app_process".
    • Remove the line that reads "target remote :5039".
    • Save and Close the file.

  6. Create ndk-gdb-eclipse. One last Eclipse housekeeping item. Eclipse will run the gdb binary itself, so we have to remove the execution of gdb from ndk-gdb. We'll save the original content by doing another Copy-Paste-Rename.

    • In your File Explorer, navigate to "/home/Dev/NDK".
    • Copy the "ndk-gdb" file and then paste it into the same folder. The result should be a file named "ndk-gdb (copy)".
    • Rename "ndk-gdb (copy)" to "ndk-gdb-eclipse".
    • Open ndk-gdb-eclipse by doing a right-click-->Open With Other Application...
    • Select Text Editor from the list of applications
    • In the file, locate the line that reads "$GDBCLIENT -x native_path $GDBSETUP" (probably at the very bottom) and comment it out by prefixing it with a "#" character.
    • Save and Close the file.

    When Debugging native sources within the Eclipse IDE, we'll use ndk-gdb-eclipse instead of ndk-gdb.

Debugging/Stepping into Code

  1. Step Into the Java Code!

    • Put a breakpoint in the DebuggingTestActivity.java file at line 20 (System.out.println("hello world!")).
    • Insert a breakpoint in your main Activity BEFORE any calls into native code are made. onCreate() is generally the best place for this.
    • Start the DebuggingTest application in Debug mode by clicking on the little arrow next to the bug and selecting "DebuggingTest Java Debug".
    • You'll see a pop-up on the screen labeled "Confirm Perspective Switch". Press "Yes" if you'd like it to switch to your Debug Perspective. I would recommend doing so.
    • At this point, you should have hit the breakpoint you set.

    Warning: The breakpoint we just hit sits inside of the onCreate function. This function will be called AFTER all static loadLibrary calls have been made. Notice that outside of the onCreate function there is a System.loadLibrary("DebuggingTestJNI") inside of a static block. This loadLibrary call will execute before we enter our onCreate function, ensuring that our native symbols are loaded by the time we hit our initial breakpoint. It is imperative that we are stopped at a breakpoint before proceeding!

  2. Step Into the C/C++ Code!

    • In your Terminal, navigate to the DebuggingTest directory and type the following command:

      ndk-gdb-eclipse <-- Remember that we created this file back in step 6

    • If successful, the command should complete without any response.
    • Go back to Eclipse and run your C/C++ debugger by clicking the little arrow next to the bug and selecting "DebuggingTest C and CPP Debug"
    • Note: When I do this, I see dozens of errors in my Eclipse console, but things still seem to be working...
    • Switch back to your Java Perspective.
    • Click the double arrows at the top right of right of your Eclipse window and select Java.
    • Open DebuggingTest/jni/com_sample_test_DebuggingTestActivity.cpp
    • Set a breakpoint in the first JNI function that will be called by your main Activity.
    • Click Run-->Resume (F8)
    • You'll get the Perspective Switch message again, so feel free to switch back to the Debug Perspective.

You should have just hit the breakpoint we just set in the native code!

Congratulations!!!

At this point you should be able to take what you've learned and adapt it to existing projects you may have.

这篇关于的Andr​​oid NDK的应用程序不能打任何断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆