有没有办法根据风格有选择地编译模块?
我试图通过在运行 debug
flavor 时不编译各种模块来减少开发中的构建时间。
在 Eclipse 中,我不会将它们放在 libs
文件夹中,而是将它们放在 addon-libs
中,并且仅在导出时编译它们(通过 gradle 构建脚本) 并且在代码中有这样的内容:
try {
if(Class.forName(clazz) {
doStuffForLib();
}
} catch (ClassNotFoundException ex) {
// DO NOTHING
}
我的问题是,我现在可以在我的 build.gradle 中做类似的事情并进一步减少构建时间吗?
也就是说,我会写这样的东西
buildTypes {
debug{
}
release {
compile 'some.module:version:1.+'
}
}
最佳答案
您可以使用 flavors 或 buildTypes 来实现它。
dependencies {
flavor1Compile xxx
debugCompile xxxx
}
关于android - 在 build.gradle 中编译选择性模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34000853/