-
Notifications
You must be signed in to change notification settings - Fork 18
Development
Setting up the development environment
- Android SDK (API 28) -> Check the system requirements
- Android Build tools (v28.0.3)
- Java (OpenJDK 8 or Oracle JDK 8)
- for the Vagrant-based build environment :
- Vagrant (>= v2.0)
- VirtualBox (>= v5.2)
- Ansible (v1.8)
- Maven (>= v3.1.1) or 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
Only required when building with Maven!
This step only needs to be done once when installing the Android SDK for the first time, or when updating the SDK to a newer version.
Due to license issues, the Android API is not available in the central Maven repository. One of the solutions is to install the required Android API to your local Maven repo (usually located in ~/.m2/repository
).
This script will install a tool to deploy the SDK and deploy the required version to the local Maven repo :
.utility/deploy-sdk-to-m2-repo.sh
- The required Android SDK (see build dependencies for the correct version) should be installed before running this script.
-
ANDROID_HOME
should be defined and point to the location of the Android SDK folder.
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 : mvn clean test
or ./gradlew clean assemble
build and test with code coverage : mvn clean cobertura:cobertura
build, test and deploy to an Android device : mvn clean install android:deploy
or ./gradlew installDebug
build, test and deploy to an Android device and run the app : mvn clean install android:deploy android:run
To disable Unit tests in maven, run with -DskipTests=true
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