如何使用新的 Android 2.0 Shrinker 并将 useProguard 设置为 false?
How to use new Android 2.0 Shrinker and set useProguard false?
我升级到 Android Studio 2.0 Beta 5。我正在使用 gradle 工具 2.0.0-beta5。在 Android dev blogspot 网站上,有一个视频解释了如何使用新的 Shrinker 进行调试构建(位于 3:14)
https://www.youtube.com/watch?list=PLWz5rJ2EKKc_w6fodMGrA1_tsI3pqPbqa&v=xxx3Fn7EowU
我正在尝试使用视频中说明的调试 buildType 构建我的项目:
debug {
minifyEnabled true
useProguard false
}
我收到一堆警告,然后在构建时出现此错误:
Error:Execution failed for task 'app:transformClassesWithNewClassShrinkerForMyAppNameGoesHereDebug'.
Warnings found during shrinking, please use -dontwarn or -ignorewarnings to suppress them.
对于 Proguard,我会在 proguard 项目文件中添加必要的适当 -dontwarn。我可以在某处添加 -dontwarn 语句的 Shrinker 项目文件吗?
我在这上面找到了一些 documentation。事实证明它使用与 Proguard 相同的配置文件。这是文档中的相关部分:
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.
此外,这里有一个示例配置供参考:
buildTypes {
debug {
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
我升级到 Android Studio 2.0 Beta 5。我正在使用 gradle 工具 2.0.0-beta5。在 Android dev blogspot 网站上,有一个视频解释了如何使用新的 Shrinker 进行调试构建(位于 3:14)
https://www.youtube.com/watch?list=PLWz5rJ2EKKc_w6fodMGrA1_tsI3pqPbqa&v=xxx3Fn7EowU
我正在尝试使用视频中说明的调试 buildType 构建我的项目:
debug {
minifyEnabled true
useProguard false
}
我收到一堆警告,然后在构建时出现此错误:
Error:Execution failed for task 'app:transformClassesWithNewClassShrinkerForMyAppNameGoesHereDebug'.
Warnings found during shrinking, please use -dontwarn or -ignorewarnings to suppress them.
对于 Proguard,我会在 proguard 项目文件中添加必要的适当 -dontwarn。我可以在某处添加 -dontwarn 语句的 Shrinker 项目文件吗?
我在这上面找到了一些 documentation。事实证明它使用与 Proguard 相同的配置文件。这是文档中的相关部分:
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.
此外,这里有一个示例配置供参考:
buildTypes {
debug {
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}