17

I try to accomplish this tutorial to learn debugging NDK apps, but when I set android:debuggable="true" in AndroidManifest.xml file the following error occurs:

Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one

How to solve it to be able to debug Teapot app?

Narek
  • 38,779
  • 79
  • 233
  • 389
  • Are you using Android Studio or Eclipse+ADT? – Martin Konecny Jun 02 '14 at 03:02
  • @MartinKonecny Eclipse+ADT+NDK+ANT. I didn't know about Android Studio which is based on Intelij. That should be a better environment. Can I just use Android Studio instead of Eclipse? Are they interchangeable or they use completely different tools and concepts? – Narek Jun 02 '14 at 03:17
  • broken youtube link... – not2qubit Jan 06 '17 at 14:48

1 Answers1

33

See official doc for SDK Tools, Revision 8 (December 2010)

Support for a true debug build. Developers no longer need to add the android:debuggable attribute to the <application> tag in the manifest — the build tools add the attribute automatically. In Eclipse/ADT, all incremental builds are assumed to be debug builds, so the tools insert android:debuggable="true". When exporting a signed release build, the tools do not add the attribute. In Ant, a ant debug command automatically inserts the android:debuggable="true" attribute, while ant release does not. If android:debuggable="true" is manually set, then ant release will actually do a debug build, rather than a release build.

Update

If you really want to disable checking for debuggable flag in Eclipse you should do next:

  1. Go to the Project Preferences:
  2. Select Android Lint Preferences
  3. Find HardcodedDebugMode Id in Security section and select it
  4. Change the value of Severity to Warning for example.
  5. Apply and Ok.

Screen for details: enter image description here

Igor Tyulkanov
  • 5,487
  • 2
  • 32
  • 49
  • The video says that I can do just `ndk-build NDK_DEBUG=1 APP_OPTIM=debug` and it will be equivalent to setting `android:debuggable="true"`, but, please see my other question: http://stackoverflow.com/questions/23985558/error-package-cookbook-chapter3-is-not-debuggable-ndk-gdb – Narek Jun 02 '14 at 03:15
  • 1
    This is the answer. `debuggable=true` is automatically set each time until you do a release build – Martin Konecny Jun 02 '14 at 03:20
  • But I have tried as view suggests: didn't use `debuggable` but used `ndk-build NDK_DEBUG=1 APP_OPTIM=debug` to build. And as in the video, I press `Debug As->Android Native Application`. At first it was rebuilding without debug info (`gdbsetup, gdbserver`). Then I removed NDK path `Preferences->Android->NDK` so that it couldn't rebuild and just run `Debug As->...` and now I have another problem: `gdbserver output: run-as: exec failed for lib/gdbserver Error:No such file or directory Verify if the application was built with NDK_DEBUG=1 – Narek Jun 02 '14 at 03:32
  • @Gary111 is it possible to disable Eclipse check of `AndroidManifest.xml`? – Narek Jun 02 '14 at 05:01
  • I tried to find how to disable this checking after your question was asked. But I have found nothing yet. – Igor Tyulkanov Jun 02 '14 at 05:05
  • Done the equivalent in Android Studio, error disappears from the editor, still throws an error when I try to compile it, won't let me build the app. – msbg May 18 '15 at 00:02
  • @Narek i'm getting same error `gdbserver output: run-as: exec failed for lib/gdbserver Error:No such file or directory Verify if the application was built with NDK_DEBUG=1` how did you solve that? – user13107 Jul 08 '15 at 04:59