如何升级ProGuard for Android? [英] How to upgrade ProGuard for Android?
问题描述
我使用Android SDK Manager
下载了最新版本的Android SDK.但是ProGuard
尚未更新,仍为4.7版.
I used Android SDK Manager
to download the latest version of Android SDK. But ProGuard
was not updated and remained at version 4.7.
是否有必要从网站手动下载ProGuard
并将其解压缩到\android-sdk\tools\proguard
?
Is it necessary to manually download ProGuard
from its website and unzip it to \android-sdk\tools\proguard
?
还是Android SDK将始终使用4.7版? 4年就是这种方式.
Or will Android SDK always use Version 4.7? It has been this way for 4 years.
推荐答案
如今,ProGuard是Android Gradle插件的依赖项,通常会与其一起更新.查看./gradlew buildEnvironment
的输出(自 2.10级),您会看到类似
These days ProGuard is a dependency of the Android Gradle plugin, and is usually updated along with it. Looking at the output of ./gradlew buildEnvironment
(supported since Gradle 2.10) you will see something like
classpath
+--- com.android.tools.build:gradle:2.2.3
| \--- com.android.tools.build:gradle-core:2.2.3
...
| +--- net.sf.proguard:proguard-gradle:5.2.1
| | \--- net.sf.proguard:proguard-base:5.2.1
如果您要使用的ProGuard版本不是Android Gradle插件所依赖的版本,则可以像这样覆盖它
If you want to use another ProGuard version than the one the Android Gradle plugin depends on you can override it like
buildscript {
configurations.all {
resolutionStrategy {
// We want version 5.3.2 instead of 5.2.1.
force 'net.sf.proguard:proguard-gradle:5.3.2'
}
}
}
这篇关于如何升级ProGuard for Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!