Maven: The Complete Reference

14.10. Device Interaction

The Android Maven Plugin has powerful features for interacting with attached devices and emulators implemented in a number of goals. They use the android.device parameter to determine a specific device as specified by the serial number, all connected emulators or all connected devices should be affected. A value of emulator will trigger execution on all emulators connected via adb and a value of usb will affect all devices.

The following goals support the device parameter and sequential execution against all devices.

android:deploy
The deploy goal deploys the built apk file, or another specified apk, to the connected device(s). This goal is automatically performed when running through the integration-test lifecycle phase on a project with instrumentation tests (e.g. mvn install or mvn integration-test).
android:undeploy
The undeploy goal removes the apk of the current project, or another specified apk, from the connected devices and emulators.
android:redeploy
The redeploy goal executes undeploy and deploy consecutively on all specified devices and emulators.
android:instrument
The instrument goal runs the instrumentation tests after automatically deploying the test application and the tests. It honors the standard Maven skip test properties as well as android.test.skip. It supports a number of further parameters that are explained in more detail in Section 14.14, “Testing Android Application Code”.
android:pull
The pull goal can be used to copy a file or directory from the device. Source and destination file have to be specified with the android.pull.source and android.pull.destination configuration parameters.
android:push
The push goal can be used to copy a file or directory to the device. Configuration is done with the android.push.source and android.push.destination parameters.
android:run
The run goal will start the application on the device. If the run.debug paramter is set to true starting will wait for a debugger to connect.