Android Maven Plugin - How to Launch an Application Automatically After Deploying It

I am wondering if there is a way to run an application that has been deployed using mvn install android:deploy automatically. If possible, this will accelerate development.

+6
source share
2 answers

Here is the post: http://www.hrupin.com/2011/06/21/how-to-run-android-application-then-you-use-maven-in-your-project

First you need to add the plugin to your POM

 <plugin> <artifactId>exec-maven-plugin</artifactId> <groupId>org.codehaus.mojo</groupId> <configuration> <executable>${basedir}/scripts/run_app.sh</executable> </configuration> </plugin> 

add a script to $ {basedir} / scripts / dir with the following contents:

 adb shell am start -a android.intent.action.MAIN -n your.app.package/.YourMainActivity 

The command to create and run the application

mvn clean install android: deploy; mvn exec: exec

+3
source

Since maven-android-plugin version 3.0.0, you can use:

 mvn install android:deploy android:run 

and it works great.

List of plugin changes here .

+15
source

Source: https://habr.com/ru/post/898751/


All Articles