問題描述
我們有一個使用新 Gradle 構建系統的 Android 項目,我們使用 Android Studio 作為開發工具.當 build.gradle
中指定了多個產品風格時,我們注意到 Android Studio 會構建第一個按字母順序指定的產品風格.有沒有辦法告訴 Android Studio 在開發過程中只構建和測試特定的產品風格?
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?
推薦答案
在 Studio 窗口的左下方有一個名為Build Variants"的停靠視圖.
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.
這篇關于Android Studio 在 build.gradle 中默認構建的 Product Flavor 是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!