Set doNotStrip packagingOptions to a specific buildType

后端 未结 1 917
伪装坚强ぢ
伪装坚强ぢ 2020-12-17 02:31

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

相关标签:
1条回答
  • 2020-12-17 02:59

    Here is a workaround for you:

    Feeding a command line option "doNotStrip"

    1. Add below to your app/build.gradle

      android {
          ...
          if (project.hasProperty("doNotStrip")) {
              packagingOptions {
                  doNotStrip '**/*.so'
              }
          }
          ...
      }
      
    2. Use below command to generate the unstripped apk by feeding option doNotStrip to the command.

      ./gradlew assembleUnstripped -PdoNotStrip
      
    3. 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.

    0 讨论(0)
提交回复
热议问题