How to avoid stripping for native code symbols for android app

4ntoine picture 4ntoine · Nov 1, 2016 · Viewed 21.2k times · Source

I'm getting sigsegv 11 in native code and i need to avoid stripping to understand what's wrong. The app uses library (aar) and i was able to avoid stripping for the aar with 'cmd-strip' hack. But in the apk stripped version of .so is used anyway so the app strips the symbols, probably while transformNative_libsWithStripDebugSymbolForDebug gradle task. Any change to avoid it?

PS. Found similar question on SO but it's a bit different (using aar here with not stripped symbols in my case).

Answer

Wayne Cai picture Wayne Cai · Feb 16, 2017

There's an undocumented method 'doNotStrip' in packagingOptions, just add following lines in your build.gradle

packagingOptions{
    doNotStrip "*/armeabi/*.so"
    doNotStrip "*/armeabi-v7a/*.so"
    doNotStrip "*/x86/*.so"
}