Skip to content

Applications on a Device

AlexandrT edited this page Oct 7, 2016 · 4 revisions

Installing an Application

It is possible to install an application apk file using the adb gem.

sn = ADB.devices[0]
ADB.wait_for_device({:serial => sn}, 60)
ADB.install 'ApiDemos.apk', nil, {:serial => sn}, 60

This operation will typically be setup using the wait_for_device command to ensure that the android device is online before attempting to install any applications

To pass options to the install operation, you can pass those as the second argument

ADB.install 'ApiDemos.apk', '-r'

This example will re-install the apk if it already exists

Uninstalling an Application

Applications may also be removed from an android device

ADB.uninstall 'com.example.android.apis', {:serial => ADB.devices[0]}

The first argument to the uninstall command is the package name used in your android application's manifest file.