-
Notifications
You must be signed in to change notification settings - Fork 18
Development
Setting up the development environment
- Android SDK (API 30) -> Check the system requirements
- Android Build tools (v30.0.3)
- Java (OpenJDK 8 or Oracle JDK 8)
- for the Vagrant-based build environment :
- Vagrant (>= v2.0)
- VirtualBox (>= v5.2)
- Ansible (v1.8)
- Gradle (v4.6), with Android for Gradle plugin (v3.2.1)
- jUnit v4.8.2 (plugin installed from maven repo during build)
- Robolectric v2.2 (plugin installed from maven repo during build)
- Mockito v1.9.5 (plugin installed from maven repo during build)
- used libraries :
- Crouton v1.8.1, Apache 2.0 (installed from maven repo during build)
- optional build tools :
- cobertura-maven-plugin v2.5.2 (>= v2.6 throws an error in combination with Robolectric, see issue #144)
- coveralls
- checkstyle
- javadoc
In the root of the getback_gps project :
vagrant up
The first time 'vagrant up' is started, the vagrant box is created. This can take several minutes, depending on your speed of your internet connection and the speed of your machine.
Every other time, 'vagrant up' launches the already provisioned Virtual box.
After starting the Vagrant box (with 'vagrant up'), you can login to the Vagrant VirtualBox. From the root of the getback_gps project :
23:12 $ vagrant ssh
Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-141-generic x86_64)
vagrant@ubuntu-xenial:~$ cd /vagrant/
vagrant@ubuntu-xenial:/vagrant$
The getback_gps project folder is mounted in /vagrant folder inside the Vagrant Virtualbox.
build and test : ./gradlew clean assemble
build and test with code coverage : mvn clean cobertura:cobertura
(maven was removed, still needs to be ported to gradle)
build, test and deploy to an Android device : ./gradlew installDebug
ubuntu@ubuntu-xenial:~$ lsusb
Bus 001 Device 002: ID 18d1:4ee2 Google Inc. Nexus 4 (debug)
In this example, vendor id is '18d1', product id is '4ee2'.
in provisioning/files/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="4ee2", GROUP="plugdev"
and run vagrant provision
to install the 51-android.rules file to /etc/udev/rules.d/
To make the android device available in the vagrant environment :
in Vagrantfile
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--usb", "on"]
v.customize ["modifyvm", :id, "--usbxhci", "on"]
v.customize ['usbfilter', 'add', '0', '--target', :id, '--name', 'Google Inc. Nexus 4 (debug)', '--vendorid', '0x18d1', '--productid', '0x4ee2']
end
On the Android device, enable Debug mode and PTP transfer mode.
More info in : https://stackoverflow.com/questions/25614067/android-studio-recognizes-physical-device-as-null
vagrant@ubuntu-xenial:/vagrant$ adb devices -l
List of devices attached
ZY224J75HS device usb:2-1 product:payton model:moto_x4 device:payton transport_id:1