什么是minifyEnabled默认为buildType没有明确的脚本? [英] What is the default for minifyEnabled for buildType not explicitly scripted?
问题描述
我进口的Eclipse工程到Android工作室(V1.1)。
I imported several eclipse projects to Android Studio (v1.1).
在原来的Eclipse环境中,他们使用Proguard的发布模式。
In the original Eclipse environment, they use Proguard for release mode.
在Android Studio环境中,这被翻译到的build.gradle
脚本如下(按进口,而不是我):
In the Android Studio environment, this was translated to the following in the build.gradle
script (by the import, not by me):
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
据我所知,这意味着的在发布
构建,使Proguard的的缩小,使用proguard.cfg的
I understand that this means that "in release
build, enable Proguard's minify, using proguard.cfg".
问题,然而,就是缩小似乎非发布版本(即调试),以及要发生!
The problem, however, is that minify seems to be happening in non-release build (i.e. debug) as well!
这怎么可能呢?
什么minifyEnabled的默认调试版本是什么?
What is the default for minifyEnabled for debug build?
更新1:由于下面的答案,我现在知道,默认为假
。这意味着别的东西正在建设调试版本缩小的各个模块。
UPDATE 1: Thanks to the answer below, I now know that the default is false
. Which means something else is building the various modules minified in debug build.
我张贴在全部为获得调试版本缩小的一个模块的build.gradle:
I am posting the entire build.gradle for one of the modules that get minified in debug build:
apply plugin: 'com.android.library'
android {
compileSdkVersion 8
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 8
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
}
整个的build.gradle
项目本身(即最高级别)是:
The entire build.gradle
for the project itself (i.e. top level) is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
我不能在这里发现任何可以解释的调试版本执行缩小。
I cannot spot here anything that could explain enforcing minify on a debug build.
更新2:怀疑应用程序的构建之间的不匹配(调试
)和它所依赖的模块(发布
?),我也查了变化范围的左侧面板上的看法。所有节目调试
明确。
UPDATE 2: Suspecting a mismatch between app's build (debug
) and the modules on which it depends (release
?), I also checked the Build Variant view on the the left panel. The all show debug
unequivocally.
更新3:看来,我打在Android的摇篮一个bug /限制?
UPDATE 3: It appears that I hit a bug/limitation in Android-Gradle?
我真的需要建的时候,应用程序内置在
模式下,所有的模块。调试
模式调试
I truly need all modules built in debug
mode when the app is built in debug
mode.
任何想法我怎么能解决这个问题?
Any ideas how I can solve this problem?
推荐答案
有关的默认值 minifyEnabled
是假
所有建设类型,@laalto回答。
The default value for minifyEnabled
is false
for all build types, as @laalto answered.
不过,目前(截至2015年4月24日),这是不是多模块的项目,其中一些模块(包括应用程序)是的依赖的真其他模块。这是由于 BUG#52962 导致构建类型的不可以传播到库 - 他们总是建成RELEASE
However, currently (as of 2015-04-24), this is not true for multi-module projects, in which some modules (app included) are dependent on other modules. This is due to bug #52962 that causes build types to not propagate to libraries -- they're always built as RELEASE.
建议来解决此bug或者其修复的通知是最欢迎的。
Suggestions to work around this bug or notifications of its fix are most welcome.
这篇关于什么是minifyEnabled默认为buildType没有明确的脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!