What Product Flavor does Android Studio build by default in build.gradle?

前端 未结 5 1756
小鲜肉
小鲜肉 2020-12-04 10:50

We have an Android project that uses the new Gradle build system, and we use Android Studio as a development tool. When there are several product flavors specified in

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 11:22

    Yes, there is a way:

    android {
        productFlavors {
            foo {
                isDefault true
            }
        }
    }
    

    And otherwise variants with the debug build type are favoured.

    It was added in Android Studio 3.5, see feature request:

    "Included in Android Gradle Plugin 3.5.0-alpha08 and Android Studio 3.5 Canary 8 [3.5.0.7].

    The heuristic for projects using older AGP and projects without explicit settings has also been updated to favour variants with the build type debug, as described in the commit message."

提交回复
热议问题