3


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.
Community
  • 1
  • 1
Jserra
  • 159
  • 1
  • 9
  • I've found that the "Add" button under "Shared Libraries" doesn't add the required trailing slash. You can dig into the eclipse settings files and edit the value, but its a bit easier to just ensure you've set a gdb command file that calls `set solib-search-path`. My experience is that not setting the search path shouldn't cause the error output you are seeing. – Shawn Jul 21 '14 at 15:42

1 Answers1

1

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

Community
  • 1
  • 1
Shawn
  • 430
  • 3
  • 7
  • I'm afraid it is not related to my question. I am able to debug the library if I change it into an app itself. The problem is, this is an android library – Jserra Jul 18 '14 at 07:17