-
Notifications
You must be signed in to change notification settings - Fork 18
Development
Setting up the development environment
- Android SDK (API 29) -> Check the system requirements
- Android Build tools (v29.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 (v6.8), with Android for Gradle plugin (v4.4.1))
- used libraries :
- Crouton v1.8.1, Apache 2.0 (library is installed during gradle build)
- unit test libraries:
- jUnit v5.7.0 (plugin is installed during gradle build)
- android-junit v1.7.0 (plugin is installed during gradle build)
- Mockito v3.7.7 (plugin is installed during gradle build
- optional build tools :
- jacoco (plugin is installed during gradle build)
- coveralls-jacoco v1.2.7 (plugin is installed during gradle build)
- javadoc (plugin is installed during gradle build)
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 run unit tests : ./gradlew clean test
build and run unit tests + lint : ./gradlew clean check
build and test with code coverage report : ./gradlew clean test jacocoTestReport
publish coverage report to Coveralls : ./gradlew coverallsJacoco
(requires COVERALLS_REPO_TOKEN env variable)
build and deploy to an Android device : ./gradlew clean 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