Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.
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.
like image 461
Jserra Avatar asked Apr 14 '26 07:04

Jserra


1 Answers

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

like image 103
Shawn Avatar answered Apr 16 '26 21:04

Shawn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!