Using Android Debug Bridge with Collect

Android Debug Bridge is a command which acts as a bridge between the Android device and the terminal. It can control device over USB from a computer, copy files back and forth, install and uninstall apps, run shell commands etc. For the developers and users of ODK Collect, the most common uses are:

  • loading blank forms to SD Card
  • fetching completed forms
  • deleting forms
  • copying the form database
  • installing the .apk file from the source code

Installing adb

If you plan to work on ODK Collect or run the app using an emulator, download the Android Studio. It already comes with the adb tool. To use it, enable USB Debugging.

To install adb as a standalone tool, please follow the instructions given here.

Forms can be manipulated from the command line itself. The following sections describe how adb can be used to work with the app.

Loading blank forms

The forms are stored in sdcard/odk/forms/ folder on the device. They can be loaded via a USB device using:

$ adb push path/to/form.xml /sdcard/odk/forms/form.xml


Path on the phone must include the file name and not just the folder name

Deleting forms

Forms can be deleted from sdcard/odk/forms by running:

$ adb shell rm -d /sdcard/odk/forms/my_form.xml

Downloading forms to your computer

To download a completed form or form instance from the computer, run:

$ adb pull /sdcard/odk/forms/my_form.xml

Downloading database

Developers might also need to check the entries in the database from the computer. In such case pull the database file from the SD card and use any SQLite visualizer to view it. To pull the database into the computer, run:

$  adb -pull /sdcard/odk/database/

Saving screenshot

For taking a screenshot, run:

$ adb exec-out screencap /sdcard/screen.png

Here, the image will be stored as screen.png which can be downloaded to the computer by running:

$ adb pull /sdcard/screen.png


You can also use ODK docs program to get a screenshot by referring to the instructions given in the Contribution Guide.

Recording a video

adb can be used to record video on device's screen. This can be done by running:

$ adb shell screenrecord /sdcard/example.mp4

As you hit Enter, this command will start recording your device’s screen using the default settings and save the resulting video to a file at /sdcard/example.mp4 file on your device.

To stop the recording, press ctrl + C