Cannot debug android native code built on android library on eclipse

与世无争的帅哥 提交于 2019-12-12 16:53:35

问题



I have been struggling with this for 3 days and I could not get it done.
I have an android project that links to an android library, containing native code, on 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
  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.
  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.

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. (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):

[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)
  • The app runs on more than one thread (executed from java via AsyncTask), but at that point only the main thread is initiated.
  • The debugging process does work only in the java side if I debug it as an android app, even in multithread.
  • I have set APP_PLATFORM as android-14 in Application.mk, same as minSdkVersion="14" in manifest.
  • I also tried restarting eclipse, rebooting the device, and unplugging and plugging the USB again.

回答1:


See this question. Likely it could be the same issue of the obj/local/armeabi folder not existing on disk.



来源:https://stackoverflow.com/questions/23887892/cannot-debug-android-native-code-built-on-android-library-on-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!