My project has 3 different buildTypes and I need only one of them to keep the debug info of its native libraries. I\'m using com.android.tools.build:gradle:3.1.4
Here is a workaround for you:
Feeding a command line option "doNotStrip
"
Add below to your app/build.gradle
android {
...
if (project.hasProperty("doNotStrip")) {
packagingOptions {
doNotStrip '**/*.so'
}
}
...
}
Use below command to generate the unstripped apk by feeding option doNotStrip
to the command.
./gradlew assembleUnstripped -PdoNotStrip
For other build types, you can still use the normal build commands. e.g.
./gradlew assembleDebug
or
./gradlew assembleRelease
but don't feed option doNotStrip
to the command.