This is very easy setup to see how this work.
- docker
If you are on linux machine you can easily install it using docker docs
In case you are on OSX, you can use vagrant. I have wrote a simple Vagrantfile for this demo.
In order to access real devices from VMs, it is necessary to create usb filters. Update Vagrantfile for this. Instructions are written in file itself.
- Connect the android device or devices to your OS X and check if they are properly connected by running
adb devices
- Get vendor_id and product_id of devices using
VBoxManage list usbhost
command. It will display something like this
UUID: e7757772-3030-44a3-ac14-00e53e9e32f8
VendorId: 0x0fce (0FCE)
ProductId: 0x519e (519E)
Revision: 2.50 (0250)
Port: 2
USB version/speed: 0/High
Manufacturer: Sony
Product: SOL23
SerialNumber: CB5125LBYM
Address: p=0x519e;v=0x0fce;s=0x0001f3695ada4522;l=0x14200000
Current State: Busy
- Uncomment the usbfilter line in Vagrantfile and rewrite it like this.
From:
v.customize ['usbfilter', 'add', '0', '--target', :id, '--name', $ANY_NAME, '--vendorid', $VENDOR_ID, '--productid', $PRODUCT_ID]
To:
v.customize ['usbfilter', 'add', '0', '--target', :id, '--name', 'Sony SOL23', '--vendorid', '0x0fce', '--productid', '0x519e']
In case you have more devices, add additional filters for them.
Ref: * https://www.virtualbox.org/manual/ch03.html#idp47384979772560 * http://spin.atomicobject.com/2014/03/21/smartcard-virtualbox-vm/
# This will also install docker
vagrant up
vagrant ssh
docker run --privileged -v /dev/bus/usb:/dev/bus/usb -e "DEVICE_SERIAL=xxxx" -e "FEATURE=addition" --name device1-addition vbanthia/appium-docker-test:latest
You need to add your device serial in DEVICE_SERIAL
env variable. It will take few minutes to download docker image for the first time.