blob: 24e97d015de89ebb49bbf0844b7da10b8acf515c [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)
11- [CrystalX Android NDK](https://www.crystax.net/en/download) version 10.1.0 or later
12
13If version 10.1.0 is used, then the following patch needs to be applied:
14
15 find crystax-ndk-10.1.0 -name byteswap.h -exec sed -i -e 's/ swap/ bswap/g' {} \;
16
17Example script for Ubuntu 14.04 to get all dependencies, download SDK and NDK:
18
19 sudo apt-get install -y build-essential git openjdk-7-jdk unzip
20 wget -q https://www.crystax.net/download/crystax-ndk-10.1.0-linux-x86_64.tar.bz2
21 tar jxf crystax-ndk-10.1.0-linux-x86_64.tar.bz2
22 find crystax-ndk-10.1.0 -name byteswap.h -exec sed -i -e 's/ swap/ bswap/g' {} \;
23
24 wget -q http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
25 tar zxf android-sdk_r24.0.2-linux.tgz
26 rm android-sdk_r24.0.2-linux.tgz
27
28 echo y | ./android-sdk-linux/tools/android update sdk -a -u -t "android-19"
29
30 wget -q https://services.gradle.org/distributions/gradle-2.2.1-bin.zip
31 unzip gradle-2.2.1-bin.zip
32
33 SDK_TOOLS_VERSION=24.0.2
34 BUILD_TOOLS_VERSION=21.1.2
35 COMPILE_SDK_VERSION=21
36
37 (sudo dpkg --add-architecture i386; sudo apt-get update -qq; sudo apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386)
38
39 export ANDROID_HOME=`pwd`/android-sdk-linux
40 export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
41
42 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
43
44 echo "y" | ~/android-sdk-linux/tools/android update sdk --filter "android-19" --no-ui --all --force
45
46## Building
47
48
49 git clone --recursive http://gerrit.named-data.net/NFD-android
50 echo sdk.dir=`pwd`/android-sdk-linux > NFD-android/local.properties
51 echo ndk.dir=`pwd`/crystax-ndk-10.1.0 >> NFD-android/local.properties
52 cd NFD-android
53
54 ../gradle/gradle-2.2.1/bin/gradle assembleRelease
55
56
57## Setting up environment using Vagrant
58
59The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided
60in `.vagrant/` folder. After vagrant command-line is installed, the following will create VM
61environment and fetch all necessary dependencies:
62
63 cd .vagrant
64 vagrant up
65
66Refer to vagrant documentation for more information.