我将几个eclipse项目导入Android Studio(v1.1).
在最初的Eclipse环境中,他们使用Proguard进行发布模式.
在Android Studio环境中,这被翻译为build.gradle脚本中的以下内容(通过导入,而不是我):
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
Run Code Online (Sandbox Code Playgroud)
我知道这意味着"在release构建中,使用proguard.cfg启用Proguard的缩小".
然而,问题是minify似乎也发生在非发布版本(即调试)中!
这怎么可能?
调试版本的minifyEnabled的默认值是什么?
更新1:感谢下面的答案,我现在知道默认是false.这意味着其他东西正在构建调试版本中缩小的各种模块.
我发布了整个 build.gradle,用于在调试版本中缩小的模块之一:
apply plugin: 'com.android.library'
android {
compileSdkVersion 8
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 8
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
}
Run Code Online (Sandbox Code Playgroud)
整个build.gradle项目本身(即顶层)是:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories { …Run Code Online (Sandbox Code Playgroud) 在build.gradle我的项目中的一个模块是非常简单的:
apply plugin: 'com.android.library'
android {
compileSdkVersion 8
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 8
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
}
}
}
dependencies {
compile project(':timsvc')
compile files('libs/jsoup-1.8.2.jar')
}
Run Code Online (Sandbox Code Playgroud)
但是,当我构建它时,它无法在外部库中找到符号jsoup-1.8.2.jar。
因为timsvc是我的一个模块,有自己的 build.gradle 和 proguard.cfg,我可以控制它的缩小级别,所以我没有任何问题。
但我不能这样做,jsoup-1.8.2.jar因为它是一个外部提供的罐子。
有没有办法将它从 Android Studio 中的 Proguard 中排除?
如果是这样,我该如何实现?