gpt4 book ai didi

android - Android Plugin for Gradle 中的 "minifyEnabled"和 "useProguard"有什么区别?

转载 作者:IT王子 更新时间:2023-10-28 23:46:04 24 4
gpt4 key购买 nike

我看到 Android Plugin for Gradle 有一个 minifyEnabled 属性以及一个 useProguard 属性,如下:

android {
buildTypes {
debug {
minifyEnabled true
useProguard false
}
release {
minifyEnabled true
useProguard true
}
}
}

这两个属性有什么区别?或者,更确切地说,每个的含义是什么?

最佳答案

引自 tools.android.com :

Built-in shrinker

Version 2.0 of Android Plugin for Gradle ships with an experimental built-in code shrinker, which can be used instead of ProGuard. The built-in shrinker supports fast incremental runs and is meant to speed up iteration cycles. It can be enabled using the following code snippet:

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

The built-in shrinker can only remove dead code, it does not obfuscate or optimize. It can be configured using the same files as ProGuard, but will ignore all flags related to obfuscation or optimization.

Unlike ProGuard, we support using the built-in shrinker together with Instant Run: depending on the project, it may significantly decrease the initial build and install time. Any methods that become reachable after a code change will appear as newly added to the program and prevent an Instant Run hotswap.

关于android - Android Plugin for Gradle 中的 "minifyEnabled"和 "useProguard"有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37007485/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com