Launch custom Gradle Android build in Android Stud

2019-04-04 04:55发布

问题:

Is there an easy way to build, install, and auto-launch a custom Gradle build in Android Studio?

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.

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.

回答1:

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.

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