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
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 :command:`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 :command:`adb` can be used to work with the app.
The forms are stored in :file:`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
Note
Path on the phone must include the file name and not just the folder name
Forms can be deleted from :file:`sdcard/odk/forms` by running:
$ adb shell rm -d /sdcard/odk/forms/my_form.xml
To download a completed form or form instance from the computer, run:
$ adb pull /sdcard/odk/forms/my_form.xml
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/database.name
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
Note
You can also use ODK docs program to get a screenshot by referring to the instructions given in the :ref:`Contribution Guide <screenshots>`.
:command:`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 :guilabel:`Enter`, this command will start recording your device’s screen using the default settings and save the resulting video to a file at :guilabel:`/sdcard/example.mp4` file on your device.
To stop the recording, press :guilabel:`ctrl` + :guilabel:`C`