Gradle 看不到产品口味。我怎样才能添加它们?

Gradle can't see product flavors. How can I add them?

当我尝试向我的项目添加风格时,Gradle 根本不想同步,即使我同步了它,我也看不到 Build Variats 中的风格。什么会导致这个问题?该项目有几个模块,我需要向应用程序添加风格。我的档案:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.24.4'
    }
}

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


def keystorePropertiesFile = "${rootDir}${File.separator}keystore.properties" as File

keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {

    dexOptions {
           javaMaxHeapSize "4g"
    }

    compileSdkVersion 25
    buildToolsVersion "25.0.3"

    defaultConfig {
        applicationId ""
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 9999
        versionName "17.2 (9999)"
    }

    productFlavors {
        testFlavor {
            applicationId "com.volodymyr.mobiletest"
        }
    }

    def keystoreFilePath = "${System.properties['user.home']}${File.separator}${keystoreProperties['storeFile']}"
    signingConfigs {
        config {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreFilePath)
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {

        }
        debug {

        }
    }
    splits {
        abi {
            enable true
            reset()
            include 'armeabi-v7a', 'arm64-v8a'//, 'x86', 'x86_64'
            universalApk true
        }
    }

    lintOptions {
        lintConfig file("lint.xml")

        check "WrongConstant"
        abortOnError true
    }
}

tasks.whenTaskAdded { task ->
    if(task.name.equals("assembleDebug")){
        task.dependsOn(lint)
    }
}
dependencies {
}

我从这里删除了一些信息,比如依赖项、id 等等,只是为了显示一个结构。

Error:(15, 0) ProductFlavor names cannot start with 'test'

你应该使用其他风味名称

问题在于此 gradle 文件仅用于 CI。要更改 gradle 配置,我需要改进位于 settings.gradle.

的构建文件