是否可以在 Android Studio 中调试 C/C++? [英] Is it possible to debug C/C++ in Android Studio?

查看:21
本文介绍了是否可以在 Android Studio 中调试 C/C++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 Android 应用程序,其中包含与 Java 代码一起编译的 C/C++ 代码.我的应用程序在执行本机代码期间崩溃.

I'm writing an Android app that includes C/C++ code that is compiled alongside the Java code. My app is crashing during the execution of the native code.

有没有办法像使用 Java 源代码一样单步执行 Android C/C++ 源代码并检查变量?

Is there a way to step through Android C/C++ source and inspect variables as it is possible with Java source?

我不一定要寻找一种方法来从 Android Studio 中逐步浏览源代码.这显然是理想的解决方案,但是,如果我需要在从 Studio 启动应用程序后使用外部工具,那很好.我希望能够逐行执行并检查变量.

I am not necessarily looking for a way to step through the source from within Android Studio. That is obviously the ideal solution, however, if I need to use an external tool after starting the app from Studio, that's fine. I want to be able to step through the execution line-by-line and inspect variables.

Android Studio 1.0.2
安卓 NDK r10d

Android Studio 1.0.2
Android NDK r10d

源于使用带有 ADT 插件的 Eclipse"的即时响应,让我添加更多要求.
该项目最初是一个 Eclipse ADT 项目.但是,我现在已经迁移到 Android Studio.我的项目现在是使用 Gradle 构建的,我的项目目录结构反映了这一点.我愿意使用Eclipse;我不愿意改变我的项目结构以从 Android Studio 恢复到 Eclipse.如果有办法在Eclipse中打开Android Studio项目并通过这种方式进行调试,请详细说明过程.

Stemming from the immediate response of, "Use Eclipse with ADT plugin", let me add more requirements.
This project started as an Eclipse ADT project. However, I have now migrated to Android Studio. My project is now built using Gradle, and my project directory structure reflects this. I am willing to use Eclipse; I am not willing to change my project structure in order to revert to Eclipse from Android Studio. If there is a way to open the Android Studio project in Eclipse and debug it that way, please elaborate on the process.

推荐答案

从 1.3+ 版本开始,Android Studio 预览版支持 C++ 调试,引用 Android M 开发者预览版 &工具:

As of version 1.3+ Preview Android Studio supports C++ debugging, quoting Android M Developer Preview & Tools:

最值得注意的是我们的 Android NDK &游戏开发者:C/C++ 代码的代码编辑和调试.Android Studio NDK 插件基于 JetBrains Clion 平台,为您的 Java 代码和 C/C++ 代码提供重构和代码完成等功能.Java 和 C/C++ 代码支持已集成为 Android 应用开发者免费的一种开发体验.

Most notable is a much requested feature from our Android NDK & game developers: code editing and debugging for C/C++ code. Based on JetBrains Clion platform, the Android Studio NDK plugin provides features such as refactoring and code completion for C/C++ code alongside your Java code. Java and C/C++ code support is integrated into one development experience free of charge for Android app developers.

这篇关于是否可以在 Android Studio 中调试 C/C++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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