在 Android Studio 中启动自定义 Gradle Android 构建 [英] Launch custom Gradle Android build in Android Studio
问题描述
是否有一种在 Android Studio 中构建、安装和自动启动自定义 Gradle 构建的简单方法?
Is there an easy way to build, install, and auto-launch a custom Gradle build in Android Studio?
当我在 Android Studio 中按下播放"(运行)按钮(使用典型的 Android 项目配置)时,我的项目会构建,将其安装在合适的设备上,然后启动应用程序.
When I press the "Play" (Run) button in Android Studio (with a typical Android project configuration), my project builds, installs it on the proper device, and then launches the app.
如何使用特定的构建/产品风格(使用 Gradle)执行此操作?我已经创建了一个运行任务installFlavor1"的 Gradle 配置.这会正确安装,但不会自动启动应用程序.
How can I do this with specific Build/Product flavors (using Gradle)? I've gotten as far as creating a Gradle configuration that runs the task "installFlavor1." This installs correctly, but it doesn't auto-launch the app.
推荐答案
您始终可以从 Android Studio 的 buildVariant 窗口
中选择不同的 buildVariant
.然后,如果您按下运行/播放按钮,您应该能够在您的设备/模拟器上安装和运行该应用程序.
You can always select a different buildVariant
from the buildVariant window
on Android Studio. And then if you press the run/play button you should be able to install and run the app on your device/emulator.
而且对我来说,在终端上运行 gradlew install**
不会启动应用程序.如果这是您正在寻找的东西,请查看 build.gradle
和 buildhelper.gradle
这里
And also for me running gradlew install**
on the terminal does not launch the app.
If that's something you are looking for then take a look at build.gradle
and buildhelper.gradle
here
这篇关于在 Android Studio 中启动自定义 Gradle Android 构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!