android – 无法更改模块buildVariant

我有一个主应用程序和3个模块的项目.他们彼此依赖

app (android application)
 |
 --- module1 (android library)
       |
       --- module2 (android library)
             |
             --- module3 (android library)         

我正在使用AS 3.0和BuildTool 3.0.0-alpha5.我应用了doc:https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#variant_dependencies中描述的更改

这是我的
build.gradle(app)

apply plugin: 'com.android.application'
android {
    ...
    buildTypes {
        debug {}
        qa {}
        release {}
    }
    flavorDimensions "default"
    productFlavors {
        flavor1 {dimension = "default"}
        flavor2 {dimension = "default"}
    }
}
dependencies {
    ...
    implementation project(path: ':module1')
    ...
}

这是我的
build.gradle(module1)

apply plugin: 'com.android.library'
android {
    ...
    buildTypes {
        debug {}
        qa {}
        release {}
    }
}
dependencies {
    ...
    implementation project(path: ':module2')
    ...
}

这是我的
build.gradle(module2)

apply plugin: 'com.android.library'
android {
    ...
    buildTypes {
        debug {}
        qa {}
        release {}
    }
}
dependencies {
    ...
    implementation project(path: ':module3')
    ...
}

我的问题:我的应用程序设置为“flavor1Debug”,但我的所有模块变体都停留在“qa”上.我无法在BuildVariant窗口中将它们切换为“debug”.

我有一个Gradle Sync警告:

Warning:
Module ‘module1’ has variant ‘debug’ selected, but the module
”app” depends on variant ‘qa’
Select ‘module1’
in “Build Variants” window

有人知道我错过了什么吗?

最佳答案 您可以更改面板构建变体的内部.

《android – 无法更改模块buildVariant》

点赞