9

Seems like ndk-build strips debug symbols when it copies .so from obj to lib folder. Is there a way to tell ndk-build not to strip the debug symbols?

dev
  • 2,180
  • 2
  • 30
  • 46

3 Answers3

17

In your Android.mk you could override cmd-strip to do what you want, e.g. nothing:

# Don't strip debug builds
ifeq ($(APP_OPTIM),debug)
    cmd-strip := 
endif
Michael
  • 57,169
  • 9
  • 80
  • 125
  • 5
    I would instead check the value of NDK_DEBUG, eg: `ifeq ($(NDK_DEBUG),1)` – gmetal Jun 02 '16 at 09:08
  • Thanks so much! IMHO, there is no reason to strip the debug build. I don't understand the motivation behind this. – kakyo Jul 17 '17 at 14:05
  • Possible reasoning behind this is that devices can be low on memory and apk can be huge (in my case it is apk with C++ tests). BTW, putting this in Application.mk doesn't work, Android.mk only. – Andrey Starodubtsev Jan 18 '18 at 14:26
  • Finally after many answers in SO, this worked. Thank you. – LincyTonita Dec 02 '20 at 08:18
2

Adding this to Application.mk solved it for me:

APP_STRIP_MODE := none

So, taking suggestions from @Michael and @gmetal:

ifeq ($(NDK_DEBUG),1)
  APP_STRIP_MODE := none
endif
vesperto
  • 804
  • 1
  • 6
  • 26
0

According to https://github.com/android/ndk/wiki/Changelog-r18-beta2

  • Use APP_STRIP_MODE in Application.mk of your NDK application
ifeq ($(NDK_DEBUG),1)
  APP_STRIP_MODE := none
endif
  • OR LOCAL_STRIP_MODE in Android.mk of your NDK module
ifeq ($(NDK_DEBUG),1)
  LOCAL_STRIP_MODE := none
endif
Sunbreak
  • 391
  • 3
  • 8