android - 无法更改模块 buildVariant

标签 android android-studio build.gradle android-library android-productflavors



我有一个包含主应用程序和 3 个模块的项目。他们像这样互相依赖

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

我将 AS 3.0 与 BuildTool 3.0.0-alpha5 一起使用。

我应用了文档中描述的更改:https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#variant_dependencies


这是我的 build.gradle(应用程序)

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 窗口中将它们切换为“调试”。

我有一个 Gradle Sync 警告:

Warning:
Module 'module1' has variant 'debug' selected, but the module ''app'' depends on variant 'qa'
Select 'module1' in "Build Variants" window

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

最佳答案

您可以更改面板构建变体的内部。

enter code here

关于android - 无法更改模块 buildVariant,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44913945/

相关文章:

java - gradle 中的 mockito 不适用于 java 项目

java - 我怎样才能得到我在调用 "*#*#8255#*#* "时得到的 android 设备 ID

java - 在Android Intent中传递任意对象

java - android.view.InflateException : Binary XML file line #13.。使用MapFragment时

android - 在 Ubuntu 11.10 上运行 adb 结果权限被拒绝

android - 我在 Android Studio 中使用 ActionBarActivity 有一些问题

java - Android:Android Studio 与 Eclipse

android - 使用 Android Studio 在设备上创建 sqlite 数据库

android - 将多密度拆分 APK 发布到 Play 商店时出错

android - 持续性错误 - 任务 ':app:transformClassesWithJarMergingForDebug' 执行失败