1*c2e18aaaSAndroid Build Coastguard Worker# Description 2*c2e18aaaSAndroid Build Coastguard Worker 3*c2e18aaaSAndroid Build Coastguard WorkerAdevice is a command-line tool that enables Android Platform developers to update their device with their locally built artifacts. The tool provides two major functions: 4*c2e18aaaSAndroid Build Coastguard Worker 5*c2e18aaaSAndroid Build Coastguard Worker* __Synchronizing files from the build output to the device.__ This includes pushing files to the device, cleaning stale on-device files, and providing guidance about conditions that could lead to a non-functional device. 6*c2e18aaaSAndroid Build Coastguard Worker* __Running post-sync actions to put the device in a consistent working state.__ These actions are based on the files that have changed and range from doing nothing to rebooting the device. 7*c2e18aaaSAndroid Build Coastguard Worker 8*c2e18aaaSAndroid Build Coastguard WorkerConceptually `adevice` tries to align the filesystem structure of the updated device to be similar to what a flash would have produced. 9*c2e18aaaSAndroid Build Coastguard Worker 10*c2e18aaaSAndroid Build Coastguard Worker`Adevice` is similar to `adb sync` in that it updates the device with files from the build staging directory but has several other differences: 11*c2e18aaaSAndroid Build Coastguard Worker 12*c2e18aaaSAndroid Build Coastguard Worker* `Adevice` has the notion of an _Update Set_ that limits what is pushed. This concept also enables a host of other features such as determining stale files and cleaning them. 13*c2e18aaaSAndroid Build Coastguard Worker* `Adevice` tracks content rather than timestamps to determine changed files. This limits the number of files that get pushed to the device. 14*c2e18aaaSAndroid Build Coastguard Worker 15*c2e18aaaSAndroid Build Coastguard WorkerNote that `adevice` does not: 16*c2e18aaaSAndroid Build Coastguard Worker 17*c2e18aaaSAndroid Build Coastguard Worker* Install APKs or APEX's to the device. This ensures that the device looks as close to what flashing would have produced. It uses `adb push`, not `adb install`. 18*c2e18aaaSAndroid Build Coastguard Worker 19*c2e18aaaSAndroid Build Coastguard Worker## Prerequisites 20*c2e18aaaSAndroid Build Coastguard Worker`Adevice` is intended for incremental updates and when there aren't many differences between the local build and the device. It is recommended to build and flash after syncing source before the first run. 21*c2e18aaaSAndroid Build Coastguard Worker 22*c2e18aaaSAndroid Build Coastguard Worker## Usage 23*c2e18aaaSAndroid Build Coastguard Worker``` adevice help ``` for more options. 24*c2e18aaaSAndroid Build Coastguard Worker 25*c2e18aaaSAndroid Build Coastguard Worker### Updating the device 26*c2e18aaaSAndroid Build Coastguard Worker``` adevice update ``` 27*c2e18aaaSAndroid Build Coastguard Worker 28*c2e18aaaSAndroid Build Coastguard Worker# Displaying the build and device status 29*c2e18aaaSAndroid Build Coastguard Worker``` adevice status ``` 30*c2e18aaaSAndroid Build Coastguard Worker 31*c2e18aaaSAndroid Build Coastguard Worker# Adding a module to the update set 32*c2e18aaaSAndroid Build Coastguard WorkerTo push modules to the device that are not normally part of the image, you can add them to the update set with: 33*c2e18aaaSAndroid Build Coastguard Worker 34*c2e18aaaSAndroid Build Coastguard Worker``` adevice track SomeModule ``` 35*c2e18aaaSAndroid Build Coastguard Worker 36*c2e18aaaSAndroid Build Coastguard Worker# Removing a module from the update set 37*c2e18aaaSAndroid Build Coastguard WorkerTo remove modules that you added to the update set: 38*c2e18aaaSAndroid Build Coastguard Worker 39*c2e18aaaSAndroid Build Coastguard Worker``` adevice untrack SomeModule ``` 40*c2e18aaaSAndroid Build Coastguard Worker 41*c2e18aaaSAndroid Build Coastguard Worker# Cleaning stale files from the device 42*c2e18aaaSAndroid Build Coastguard Worker``` adevice clean ``` 43*c2e18aaaSAndroid Build Coastguard Worker 44*c2e18aaaSAndroid Build Coastguard WorkerYou can specify which connected device to use with the environment variable ANDROID_SERIAL or with the `-s` flag. 45