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
deploygoal deploys the built apk file, or another specified apk, to the connected device(s). This goal is automatically performed when running through theintegration-testlifecycle phase on a project with instrumentation tests (e.g.mvn installormvn integration-test). - android:undeploy
-
The
undeploygoal removes the apk of the current project, or another specified apk, from the connected devices and emulators. - android:redeploy
-
The
redeploygoal executes undeploy and deploy consecutively on all specified devices and emulators. - android:instrument
-
The
instrumentgoal runs the instrumentation tests after automatically deploying the test application and the tests. It honors the standard Maven skip test properties as well asandroid.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
pullgoal can be used to copy a file or directory from the device. Source and destination file have to be specified with theandroid.pull.sourceandandroid.pull.destinationconfiguration parameters. - android:push
-
The
pushgoal can be used to copy a file or directory to the device. Configuration is done with theandroid.push.sourceandandroid.push.destinationparameters. - android:run
-
The
rungoal will start the application on the device. If the run.debug paramter is set to true starting will wait for a debugger to connect.