简体   繁体   English

如何从Android Studio构建产品风格?

[英]How to build product flavors from Android Studio?

I have defined some product flavors in my build.gradle. 我在build.gradle中定义了一些产品风格。 I am able to successfully build them using gradlew . 我能够使用gradlew成功构建它们。

I can't figure out how I do so from the Android Studio IDE. 我无法弄清楚我是如何从Android Studio IDE中这样做的。

(My project was initially done in Eclipse then I've migrated to the Android Studio) (我的项目最初是在Eclipse中完成的,然后我已迁移到Android Studio)

Build Variants appears as a vertical button along the bottom of the left edge of the workspace. 构建变量显示为工作区左边缘底部的垂直按钮。 If it's not visible, click the little rectangle icon on the lower left corner. 如果看不到,请单击左下角的小矩形图标。

You can Choose the flavor you want to run on device or emulator selecting from the BuildVariants panel 您可以从BuildVariants面板中选择要在设备或模拟器上运行的风格

在此输入图像描述

To generate all the apk of each flavor , you can run the Gradle build task and the files will appear in the folder yourmodule / build / ouputs / apk . 要生成每种风格的所有apk,您可以运行Gradle构建任务,文件将出现在文件夹yourmodule / build / ouputs / apk中。

Build task can be run from the console or from the task pane Gradle 可以从控制台或任务窗格Gradle运行构建任务

在此输入图像描述

In the upper right hand corner of android studio click "gradle". 在android studio的右上角点击“gradle”。

Drop down your package > tasks > build > build { DOUBLE CLICK IT } 下拉包>任务>构建>构建{DOUBLE CLICK IT}

This will begin building all your flavors. 这将开始构建您的所有口味。

[ [ 在此输入图像描述

[ [ 在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM