简体   繁体   English

无法在eclipse上调试基于android库的android本机代码

[英]Cannot debug android native code built on android library on eclipse


I have been struggling with this for 3 days and I could not get it done. 我一直在努力奋斗3天,我无法完成它。
I have an android project that links to an android library, containing native code, on eclipse. 我有一个android项目链接到一个包含本机代码的android库,在eclipse上。
I saw this question , which is the same schema as mine, but the steps proposed there would not work. 我看到了这个问题 ,这与我的模式相同,但是那里提出的步骤是行不通的。

I rewrite the steps here, which are: 我重写了这里的步骤,它们是:

  1. Go to "Run" menu-> "Debug Configurations" 转到“运行”菜单 - >“调试配置”
  2. Under "Android Native Application" in the left pane, select your application 在左侧窗格的“Android Native Application”下,选择您的应用程序
  3. Under the "Debugger" tab click "Add..." in the "Shared Libraries" section. 在“调试器”选项卡下,单击“共享库”部分中的“添加...”。
  4. Browse to your android library project directory and add its subdirectory obj/local/armeabi. 浏览到您的android库项目目录并添加其子目录obj / local / armeabi。
  5. Apply and debug. 应用和调试。

First problem was, I could not set up Debug config for native app if the application is not set up as native, (only links to a native app), so I cannot select any project to debug. 第一个问题是,如果应用程序未设置为本机应用程序(仅链接到本机应用程序),我无法为本机应用程序设置Debug配置,因此我无法选择任何要调试的项目。

I tried setting the android app project as having c/c++ nature, with dummy jni/Android.mk, as just not showing any error on build. 我尝试将Android应用程序项目设置为具有c / c ++特性,使用虚拟jni / Android.mk,因为在构建时没有显示任何错误。 (I doubt this is the right way to go, though) (我怀疑这是正确的方法)
The app then runs and links correctly, and I am able to follow those steps --1 to 5. But as I debug it, the console shows (BasicCharacterWithLib is the name of the app): 该应用程序然后运行并正确链接,我能够按照这些步骤--1到5.但是当我调试它时,控制台显示(BasicCharacterWithLib是应用程序的名称):

[2014-05-27 12:18:09 - BasicCharacterWithLib] Error while obtaining file from device
[2014-05-27 12:18:09 - BasicCharacterWithLib] com.android.ddmlib.SyncException: Writing local file failed!

And it would never stop on any breakpoint (native or not) 并且它永远不会停在任何断点上(原生或不是)

I am also aware of this other question , having the same symptoms on a different configuration (directly executing an app), but it remains unanswered. 我也知道另一个问题 ,在不同的配置(直接执行应用程序)上具有相同的症状,但它仍然没有答案。

I have successfully debugged another app in the same device, a test app having native code inside it, so I guess the problem cannot be due to the device config. 我已经成功调试了同一个设备中的另一个应用程序,一个测试应用程序里面有本机代码,所以我猜问题不能归因于设备配置。

Do you know how to solve it? 你知道怎么解决吗?

some further details: 更多细节:

  • I use eclipse from adt bundle (version v22.6.2, sdk highest api level available is 19 and ndk version is r9) 我使用adt bundle中的eclipse(版本v22.6.2,可用的sdk最高api级别是19,ndk版本是r9)
  • The app runs on more than one thread (executed from java via AsyncTask), but at that point only the main thread is initiated. 该应用程序在多个线程上运行(通过AsyncTask从java执行),但此时只启动主线程。
  • The debugging process does work only in the java side if I debug it as an android app, even in multithread. 如果我将它调试为Android应用程序,即使在多线程中,调试过程也只能在java端工作。
  • I have set APP_PLATFORM as android-14 in Application.mk, same as minSdkVersion="14" in manifest. 我在Application.mk中将APP_PLATFORM设置为android-14,与清单中的minSdkVersion =“14”相同。
  • I also tried restarting eclipse, rebooting the device, and unplugging and plugging the USB again. 我还尝试重新启动eclipse,重新启动设备,再次拔出并插入USB。

See this question . 看到这个问题 Likely it could be the same issue of the obj/local/armeabi folder not existing on disk. 可能它可能是磁盘上不存在的obj/local/armeabi文件夹的相同问题。

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

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