试图将我的productFlavor命名为“test”并收到错误:
ERROR: ProductFlavor names cannot start with 'test'
从源代码我看到简单的检查:
private void addBuildType(BuildType buildType) {
if (buildType.name.startsWith("test")) {
throw new RuntimeException("BuildType names cannot start with 'test'")
}...
}
出现我可以使用“myTest”,“aTest”等名称,但不能使用“test1”,“test2”等。任何可能的原因?谢谢。
正如您在此Google repository第93行中看到的那样
private void addBuildType(BuildType buildType) {
if (buildType.name.startsWith("test")) {
throw new RuntimeException("BuildType names cannot start with 'test'")
}
if (productFlavors.containsKey(buildType.name)) {
throw new RuntimeException("BuildType names cannot collide with ProductFlavor names")
}
def sourceSet = project.sourceSets.add(buildType.name)
BuildTypeData buildTypeData = new BuildTypeData(buildType, sourceSet, project)
project.tasks.assemble.dependsOn buildTypeData.assembleTask
buildTypes[buildType.name] = buildTypeData
}
所以addBuildType
方法有自己的例外,关于不使用test
名称。你不能用这个。他们为什么做出这个决定。没有人可以回答,除了谷歌。