简体   繁体   English

使用DS-5在Android中调试本机(c / c ++)代码

[英]Debugging native (c/c++) code in Android with DS-5

I'm trying to debug an Android project that has native code with the ARM development studio but I can't make it to work. 我正在尝试使用ARM开发工作室调试一个具有本机代码的Android项目,但无法使其正常工作。

I tried all kind of tutorials and other online help I could find but when I try to debug it just won't work. 我尝试了所有可以找到的教程和其他在线帮助,但是当我尝试调试它时将不起作用。

I then decided to try a simple example instead of my (more) complicated project just to firstly get the debugger going but even that fails. 然后,我决定尝试一个简单的示例,而不是我的(更复杂的)项目,只是为了首先使调试器运行,但即使失败了。
I'm using this tutorial: Loading the hello-neon application on to an Android target (except that I want to run it on a real device). 我正在使用本教程: 将hello-neon应用程序加载到Android目标上 (除了我想在真实设备上运行它)。
I followed all of the steps but when I finally try to debug I get this message: 我遵循了所有步骤,但是当我最终尝试调试时,收到以下消息:

Unable to connect to Hello Neon Example. 无法连接到Hello Neon Example。

Reason: 原因:

The script file ( push_pull.py ) failed during execution: 脚本文件(push_pull.py)在执行期间失败:

Timeout error checking adb connection 超时错误检查ADB连接

See Target Console view for more details 有关更多详细信息,请参见目标控制台视图

The "Target Console" is empty and offers no more details. “目标控制台”为空,不提供更多详细信息。

I'm working with eclipse (Juno release 2) on a linux machine (64bit Mint 12) and NDK r8e. 我正在Linux机器(64位Mint 12)和NDK r8e上使用Eclipse(Juno版本2)。
The device I'm trying to run the project on is a Samsun S2 (android 4.1.2). 我要在其上运行项目的设备是Samsun S2(android 4.1.2)。

Any ideas why this happens? 任何想法为什么会发生这种情况?
Thanks. 谢谢。

I've got the same problem. 我有同样的问题。 But there was no any problem with debuging native part of app a month or two earlier.It worked perfectly. 但是在一两个月前调试应用程序的本机部分没有任何问题。 I'm very confused, but in process of solving this issue. 我很困惑,但是正在解决这个问题。 First of all look if there is a "gdbserver"-file in folder "Binaries" (C/C++ perspective)? 首先查看文件夹“ Binaries”中是否有“ gdbserver”文件(C / C ++透视图)? And the second thing: I think that there is a problem with ADB-connection. 第二件事:我认为ADB连接存在问题。 I've tried variouse devices (Sony Xperia and two rooged tabs, small and big produced by HTC) and variouse OS (OS x mavericks eclipse kepler with ARM and Android plugins and Ubuntu 12.04 DS-5 CE with android plugin); 我已经尝试过各种设备(Sony Xperia和两个由HTC生产的大小标签)和各种OS(带有ARM和Android插件的OS x mavericks eclipse kepler以及带有android插件的Ubuntu 12.04 DS-5 CE); here is the result: debuging started only on big HTC on Mac, because when i plug HTC only, DS-5 perspective start to resive a device info in DS Debug config in frame "connections" where you choose a device (Device information:API leven, etc., Root access available ) maybe the problem is in root access .... 结果是:调试仅在Mac上的大型HTC上开始,因为当我仅插入HTC时,DS-5透视图开始在您选择设备的“连接”框架中的DS Debug配置中显示设备信息(设备信息:API leven等, 可用root访问权限 )也许问题出在root访问中。

Continue solving... 继续解决...

Here is the solve. 这是解决方法。 In your ds-5 debug configuration check up your device (in "connections" panel), compair it's ser.No. 在ds-5调试配置中,检查您的设备(在“连接”面板中),对它的序列号进行评估。 with that number that you can get when exec command "adb devices" (device must be connected, offcourse). 使用执行命令“ adb devices”(设备必须已连接,离线)时可获得的编号。 If there is no device in list check up your JRE, it must be from Oracle, and installed like mentioned here this link has taken from here. 如果列表中没有设备,请检查您的JRE,它必须来自Oracle,并按此处所述进行安装,此链接已从此处获取。 then restart eclipse (or OS) If that not help copy adb from android-sdk dir to /bin/ or export $PATH (in my case i've got an exportation< but needed to copy adb). 然后重新启动eclipse(或OS),如果这不帮助将adb从android-sdk目录复制到/ bin /或导出$ PATH(在我的情况下,我有一个export <,但需要复制adb)。 If device appear in list - thats good)))) select it and look for "device information"...And here is the very important point - there must be a root access to it!!! 如果设备出现在列表中-很好))))选择它并查找“设备信息” ...这是非常重要的一点-必须有root访问权限!!!

And here is one practical advise: start your DS-5 from terminal, to see what's going on with it. 这里是一个实用建议:从终端启动DS-5,以查看其发生的情况。

看起来您的设备未连接,如果您看到某些设备被列为脱机,请尝试使用“ adb设备”列出您的设备,请通过以下信息解决此问题: Android 4.2.2设备脱机

Here is the solve. 这是解决方法。 In your ds-5 debug configuration check up your device (in "connections" panel), compair it's ser.No. 在ds-5调试配置中,检查您的设备(在“连接”面板中),对它的序列号进行评估。 with that number that you can get when exec command "adb devices" (device must be connected, offcourse). 使用执行命令“ adb devices”(设备必须已连接,离线)时可获得的编号。 If there is no device in list check up your JRE, it must be from Oracle, and installed like mentioned here this link has taken from here . 如果列表中没有设备,请检查您的JRE,它必须来自Oracle,并按此处所述安装此链接已从此处获取 then restart eclipse (or OS) If that not help copy adb from android-sdk dir to /bin/ or export $PATH (in my case i've got an exportation< but needed to copy adb). 然后重新启动Eclipse(或OS)如果不帮助来自Android的SDK目录拷贝ADB为/ bin /或出口$ PATH(在我的情况我有一个出口<但复制亚行需要)。 If device appear in list - thats good)))) select it and look for "device information"...And here is the very important point - there must be a root access to it !!! 如果设备出现在列表中-很好))))选择它并查找“设备信息” ...这是非常重要的一点- 必须有root访问权限

And here is one practical advise: start your DS-5 from terminal, to see what's going on with it. 这里是一个实用建议:从终端启动DS-5,以查看其发生的情况。

Here's what worked for me... 这是对我有用的...

Remove all devices except the device you'll work on 删除所有设备,除了要使用的设备

$ adb kill-server
$ adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
$ adb root
adbd is already running as root

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM