在settings.gradle中添加以下代码
Properties properties = new Properties()
properties.load(new FileInputStream(new File('local.properties')))
def settings = properties.getProperty("settings")
if(settings == null){
settings = 'default_settings';
}
apply from: "${settings}.gradle"
创建默认default_settings.gradle文件
//default_settings.gradle
include ':app', ':library'
指定其它gradle文件
//local.properties
settings=other_settings
例如
//other_settings.gradle
include ':app', ':library', 'local_module1', 'local_module2', 'local_module3', 'local_module4'