`
cppmule
  • 浏览: 450611 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类

Debugging the hello-jni project with Visual Studio

 
阅读更多

Debugging the hello-jni project with Visual Studio

转载自:http://visualgdb.com/tutorials/android/hello-jni/

This quickstart guide shows how to build and debug the hello-jni simple sample from Android NDK.

Before you begin, please install VisualGDB 2.0 (ensure that "Android Edition" is checked in the installer).

  1. Start Visual Studio. Select File->New project->Visual C++->VisualGDB->Android App Wizard.
  2. We will make a copy of the hello-jni sample project to experiment with it leaving the original files untouched. Please select a directory and a name for the project copy.
  3. If you are running VisualGDB Android wizard for the first time, please press the "Configure NDK/SDK locations" button to tell VisualGDB the locations of your Android-related tools. If you don't have any of the tools installed, simply press the "install" button.WARNING! After installing Android SDK please run the SDK manager as Administrator and install the Tools (SDK tools/Platform tools) and all required Android APIs (at least Android 1.5 and  2.3.3).
  4. In this tutorial we are creating a copy of an existing NDK sample. Please select the second option to do this:
  5. The next page allows selecting a sample project to copy. Please select hello-jni and press "next".
  6. Finally VisualGDB wizard will ask you for the targeted Android platform. You will be able to change the platform in the VisualGDB project settings later. Please select Android 1.5 for now.
  7. When you press "Finish", VisualGDB will create a copy of the hello-jni sample for you. If you have an Android phone or a tablet, you can enable USB debugging on it and connect it to your PC. If not, please start the Android simulator (AVD Manager) by selecting "Android->AVD Manager" in Visual Studio:
  8. If you have no virtual devices defined by now, please create one. It is recommended to specify at least Android 2.3.3 as the simulator platform.
  9. Start the virtual device. While it is booting, go to Visual Studio, and select Build->Build Solution.
  10. Once the solution has been built, please ensure that the virtual Android device has been started.
  11. Once the device is ready, go to Visual Studio and select Debug->Start Debugging with GDB. VisualGDB will deploy the APK file automatically and will start a debugging session.
  12. If you are using the simulator instead of a real Android device, it might take up to several minutes for the debugging to start.
  13. Once the debugging is started, you can use the Visual Studio interface to set breakpoints, stop program execution, step through code or inspect variables. You will additionally see the output from the gdbserver in the Remote Console window:
  14. Go to the simulator and ensure that the app has been started.
  15. As the native function is only invoked during startup when the debugger is not yet attached, setting a breakpoint there won't result in any hits. You can either modify the Java code to call the native function continuously, or use the Debug->Break All command:
  16. You can use the Threads and Call Stack windows to observe currently running threads and their stacks:
  17. When you are done debugging, press Shift+F5 to close the app.
分享到:
评论

相关推荐

    MySQL for Visual Studio 2.0.4官方版

    MySQL for Visual Studio provides access to MySQL objects and data using Microsoft Visual Studio. MySQL for Visual Studio provides: Design Time Support Query Designer Stored Routine Debugging Entity ...

    Developing Applications With Visual Studio.Net

    DEVELOPING APPLICATIONS WITH VISUAL STUDIO.NET is an in-depth guide that takes Windows programming to the next level: creating .NET applications that leverage the prior knowledge and experience of C++...

    [Visual Studio] Visual Studio 2013 高级编程 (英文版)

    Visual Studio 2013 includes better support for advanced debugging techniques, vast improvements to the visual database tools, and new support for UI testing for Windows Store apps. This update is the ...

    Mastering Visual Studio 2017

    Visual Studio 2017 is packed with improvements that increase productivity, and this book will get you started with the new features introduced in Visual Studio 2017 IDE and C# 7.0. Next, you will ...

    Professional Visual Studio 2010(part1)

    Packed with helpful examples, this comprehensive guide explains how Visual Studio 2010 offers you a unique look at the beginning of the IDE’s evolution: improved code navigation, annotation and ...

    Mastering Visual Studio 2019 2nd Edition

    By the end of the Mastering Visual Studio 2019, Second Edition book, you’ll have become a more efficient Visual Studio 2019 user, and be able to use it for developing, testing, debugging and ...

    vscode-java-debug,用于VisualStudio代码的Java调试器。.zip

    【标题】:“vscode-java-debug”是一个专门为Visual Studio Code(VSCode)开发的Java调试扩展,使得开发者在使用VSCode时能够便捷地进行Java程序的调试工作。 【描述】:这个扩展是开源项目,意味着其源代码对...

    BRK3182 - Supercharge your debugging in Visual Studio 2017.pptx

    BRK3182 - Supercharge your debugging in Visual Studio 2017.pptx

    Visual Studio 2015 Tools for Unity

    Extension: Fix a conflict with ReSharper where controls in the settings of Visual Studio would not be displayed. Extension: Introduce an option to allow modifying the generated project properties. ...

    Debugging-with-GDB.zip_Debugging with GDB

    《使用GDB进行调试》 GDB(GNU Debugger)是开源社区GNU开发的一款强大的源代码级调试器,广泛应用于C、C++等编程语言。它允许程序员在运行时检查和控制程序,查找并修复错误,从而提高软件的质量和可靠性。...

    Unity-debugging-5.x.zip

    1. **脚本调试**:Unity内置的Visual Studio集成使得开发者可以直接在IDE中设置断点,查看变量值,跟踪调用堆栈。配合dnspy,可以进一步查看Unity引擎内部的函数调用。 2. **性能分析**:通过Profiler模块,开发者...

    Debugging by Thinking - A Multidisciplinary Approach.rar

    "Debugging by Thinking" 提倡的是一种系统性的、逻辑性的思维方式,它融合了计算机科学、心理学、逻辑学等多个领域的理论与实践,帮助开发者构建一个全面的调试框架。 1. 计算机科学基础:调试首先需要对编程语言...

    Debugging with GDB --2007年

    Debugging programs with multiple processes . . . . . . . . . . . . 23 23 24 25 26 26 27 28 28 31 ii 5 Debugging with GDB Stopping and Continuing . . . . . . . . . . . . . . . . . . 33 5.1 Breakpoints....

    Professional Visual Studio 2013 英文原版

    Visual Studio 2013 includes better support for advanced debugging techniques, vast improvements to the visual database tools, and new support for UI testing for Windows Store apps. This update is the ...

    微软Visual Studio 2017社区版安装文件

    •You can create and associate Azure Key Vaults from within the Visual Studio IDE. •Visual Studio Tools for Xamarin can automatically install missing Android API levels required by Xamarin.Android ...

    Visual Studio 2005 Remote Debugging.mht

    Visual Studio 2005 Remote Debugging.mht

    Professional Visual Studio 2010(part2)

    Packed with helpful examples, this comprehensive guide explains how Visual Studio 2010 offers you a unique look at the beginning of the IDE’s evolution: improved code navigation, annotation and ...

Global site tag (gtag.js) - Google Analytics