Adb

From Void Linux Wiki
Jump to: navigation, search

Installation

$ sudo xbps-install android-tools

Launch adb at boot time

Create an android user

This user will be the owner of the adb server process.

Udev rules

To make connection possible with the usb device, we are going to add some rules to Udev. First, we need to know the vendor_id:product_id pair.

$ lsusb

Next, let's create a new set of rules

$ echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="[VENDOR ID]", MODE="0666", OWNER="android"'  > /etc/udev/rules.d/51-android.rules

If /etc/udev/rules.d doesn't exist, you have to create it. To make this rule work, you have to unplug-replug your device (and for every single saved change of the file).

Edit the run script

Finally, you need to edit the run script of adb (/etc/sv/adb/run) by adding to something like this

chpst adb <irrelevant_opt>

to that

HOME=/home/android/ chpst -u android adb <irrelevant_opt>
Note: The HOME is actually the directory where adb will create .android, which stores the RSA key needed for the PC-Device authentification . You must put a directory where the android user have enough permission to create .android.

Add the service

A runit service is included into the android-tools package. To activate it, simply:

$ sudo ln -s /etc/sv/adb /var/service

Basic commands

Pushing

  • push a file into a directory :
 $ adb push /some/thing/myfile /my/android/directory/
  • push a file (creation) :
$ adb push /some/thing/myfile /my/android/target
  • push a directory content into another:
$ adb push /some/thing/mydirectory/  /my/android/directory/

Installing

$ adb install /some/where/app.apk

Sources

https://wiki.archlinux.org/index.php/android