【问题标题】:Code shrinking on debug调试时代码收缩
【发布时间】:2018-01-27 12:15:09
【问题描述】:

在发布应用程序之前,我正在尝试测试如果我使用 Instant 运行应用程序进行代码收缩,是否会有任何更改(方法、变量被删除)。我正在关注这个Enable code shrinking with Instant Run,但它在我的代码中没有显示任何被删除或更改的迹象。

android {
buildTypes {
         debug {
             minifyEnabled true
             useProguard false
             proguardFiles getDefaultProguardFile('proguard-android.txt'),
                     'proguard-rules.pro'
         }  
   }     
}

有什么方法可以检查是否进行了更改?

【问题讨论】:

    标签: android proguard


    【解决方案1】:

    你应该使用收缩选项 -printUsage 它会告诉你死代码,最终会在收缩过程中被删除。

    -printusage [文件名] 指定列出输入类文件的死代码。该列表被打印到标准输出或给定文件。例如,您可以列出应用程序的未使用代码。仅在收缩时适用。

    【讨论】:

      【解决方案2】:
      android {
          ...
          buildTypes {
              release {
                  shrinkResources true
                  minifyEnabled true
                  proguardFiles getDefaultProguardFile('proguard-android.txt'),
                      'proguard-rules.pro'
              }
          }
      }
      

      【讨论】:

      • 请考虑添加一些上面的代码应该执行的cmets
      猜你喜欢
      • 1970-01-01
      • 2011-01-31
      • 2019-09-25
      • 2011-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多