問題描述
我們有一個(gè)使用新 Gradle 構(gòu)建系統(tǒng)的 Android 項(xiàng)目,我們使用 Android Studio 作為開發(fā)工具.當(dāng) build.gradle
中指定了多個(gè)產(chǎn)品風(fēng)格時(shí),我們注意到 Android Studio 會(huì)構(gòu)建第一個(gè)按字母順序指定的產(chǎn)品風(fēng)格.有沒有辦法告訴 Android Studio 在開發(fā)過程中只構(gòu)建和測(cè)試特定的產(chǎn)品風(fēng)格?
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 窗口的左下方有一個(gè)名為Build Variants"的停靠視圖.
On the lower left of the Studio window there's a docked view called "Build Variants".
打開它并選擇您想要處理的任何變體.這將影響構(gòu)建的變體以及啟用的源文件夾,這將推動(dòng)代碼和資源編輯器中的完成.
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.
這篇關(guān)于Android Studio 在 build.gradle 中默認(rèn)構(gòu)建的 Product Flavor 是什么?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!