blob: 782b9b2239eb1c91d4c95c687fdc498acd6fc82b [file] [log] [blame] [view]
Alexander Afanasyev087c7c12015-02-02 00:21:21 -08001NFD on Android
2==============
3
4[![Build Status](https://travis-ci.org/named-data/NFD-android.svg?branch=master)](https://travis-ci.org/named-data/NFD-android)
5
6## Prerequisites
7
8To compile code, the following is necessary
9
10- Appropriate [Android SDK](http://developer.android.com/sdk/index.html)
Alexander Afanasyev92bf1722015-09-04 13:45:00 -070011- [CrystalX Android NDK](https://www.crystax.net/en/download) version 10.2.1 or later
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080012
13Example script for Ubuntu 14.04 to get all dependencies, download SDK and NDK:
14
15 sudo apt-get install -y build-essential git openjdk-7-jdk unzip
Alexander Afanasyev92bf1722015-09-04 13:45:00 -070016 wget -q https://www.crystax.net/download/crystax-ndk-10.2.1-linux-x86_64.tar.bz2
17 tar jxf crystax-ndk-10.2.1-linux-x86_64.tar.bz2
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080018
19 wget -q http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
20 tar zxf android-sdk_r24.0.2-linux.tgz
21 rm android-sdk_r24.0.2-linux.tgz
22
23 echo y | ./android-sdk-linux/tools/android update sdk -a -u -t "android-19"
24
Alexander Afanasyev92bf1722015-09-04 13:45:00 -070025 wget -q https://services.gradle.org/distributions/gradle-2.6-bin.zip
26 unzip gradle-2.6-bin.zip
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080027
28 SDK_TOOLS_VERSION=24.0.2
29 BUILD_TOOLS_VERSION=21.1.2
30 COMPILE_SDK_VERSION=21
31
32 (sudo dpkg --add-architecture i386; sudo apt-get update -qq; sudo apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386)
33
34 export ANDROID_HOME=`pwd`/android-sdk-linux
35 export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
36
37 echo "y" | ~/android-sdk-linux/tools/android update sdk --filter platform-tools,build-tools-$BUILD_TOOLS_VERSION,android-$COMPILE_SDK_VERSION,extra-android-support,extra-android-m2repository,extra-google-m2repository --no-ui --all --force
38
39 echo "y" | ~/android-sdk-linux/tools/android update sdk --filter "android-19" --no-ui --all --force
40
41## Building
42
43
44 git clone --recursive http://gerrit.named-data.net/NFD-android
45 echo sdk.dir=`pwd`/android-sdk-linux > NFD-android/local.properties
Alexander Afanasyev92bf1722015-09-04 13:45:00 -070046 echo ndk.dir=`pwd`/crystax-ndk-10.2.1 >> NFD-android/local.properties
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080047 cd NFD-android
48
Alexander Afanasyev92bf1722015-09-04 13:45:00 -070049 ../gradle/gradle-2.6/bin/gradle assembleRelease
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080050
51
52## Setting up environment using Vagrant
53
54The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided
55in `.vagrant/` folder. After vagrant command-line is installed, the following will create VM
56environment and fetch all necessary dependencies:
57
58 cd .vagrant
59 vagrant up
Alexander Afanasyev81e7d872015-04-19 19:38:26 -070060 vagrant ssh
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080061
62Refer to vagrant documentation for more information.