What Product Flavor does Android Studio build by d

2019-01-16 06:12发布

问题:

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 build.gradle, we notice that Android Studio builds the first one specified alphabetically. Is there a way to tell Android Studio to build and test only a specific product flavor during development?

回答1:

On the lower left of the Studio window there's a docked view called "Build Variants".

Open it and choose whichever variant you want to work on. This will impact which variant is built but also the enabled source folders, which will drive completion in code and resources editors.



回答2:

Currently there appears to be no way to select default flavor. There is a feature request in Android Issue Tracker for it:

https://code.google.com/p/android/issues/detail?id=64917

You can star/vote the request, so it gets higher priority on Android development tools backlog.



回答3:

You can specify the command run In Section Before launch Gradle-aware Make

You can list all gradle tasks by gradlew tasks