blob: dbd75fc28b8797723d4080f6ff6a4ad95f14d4ee [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
Alexander Afanasyevf3812562016-01-21 16:28:33 -080010- Recent version of [Android SDK](http://developer.android.com/sdk/index.html), android-21 SDK
11 and 21.1.2 build tools (for build), android-19 SDK (for compatibility), and several other SDK
12 components
13- [CrystalX Android NDK](https://www.crystax.net/en/download) version 10.3.1
14- [Gradle build automation system](http://gradle.org/) version 2.10
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080015
16Example script for Ubuntu 14.04 to get all dependencies, download SDK and NDK:
17
Alexander Afanasyevf3812562016-01-21 16:28:33 -080018 CRYSTAX_NDK_VERSION=10.3.1
19 GRADLE_VERSION=2.10
20 SDK_VERSION=24.4.1
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080021
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080022 BUILD_TOOLS_VERSION=21.1.2
23 COMPILE_SDK_VERSION=21
24
Alexander Afanasyevf3812562016-01-21 16:28:33 -080025 sudo apt-get install -y build-essential git openjdk-7-jdk unzip
26
27 # SDK binaries need i386 libraries
28 sudo dpkg --add-architecture i386;
29 sudo apt-get update -qq; sudo apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386
30
31 wget https://www.crystax.net/download/crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
32 tar xf crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
33 rm crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
34
35 wget http://dl.google.com/android/android-sdk_r$SDK_VERSION-linux.tgz
36 tar zxf android-sdk_r$SDK_VERSION-linux.tgz
37 rm android-sdk_r$SDK_VERSION-linux.tgz
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080038
39 export ANDROID_HOME=`pwd`/android-sdk-linux
40 export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
41
Alexander Afanasyevf3812562016-01-21 16:28:33 -080042 echo "y" | 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 echo "y" | android update sdk --filter "android-19" --no-ui --all --force
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080044
Alexander Afanasyevf3812562016-01-21 16:28:33 -080045 wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip
46 unzip gradle-$GRADLE_VERSION-bin.zip
47 rm gradle-$GRADLE_VERSION-bin.zip
48 export PATH=$PATH:`pwd`/gradle-$GRADLE_VERSION/bin
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080049
50## Building
51
52
53 git clone --recursive http://gerrit.named-data.net/NFD-android
54 echo sdk.dir=`pwd`/android-sdk-linux > NFD-android/local.properties
Alexander Afanasyevf3812562016-01-21 16:28:33 -080055 echo ndk.dir=`pwd`/crystax-ndk-10.3.1 >> NFD-android/local.properties
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080056 cd NFD-android
57
Alexander Afanasyevf3812562016-01-21 16:28:33 -080058 ../gradle/gradle-2.10/bin/gradle assembleRelease
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080059
60
61## Setting up environment using Vagrant
62
63The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided
64in `.vagrant/` folder. After vagrant command-line is installed, the following will create VM
65environment and fetch all necessary dependencies:
66
67 cd .vagrant
68 vagrant up
Alexander Afanasyev81e7d872015-04-19 19:38:26 -070069 vagrant ssh
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080070
71Refer to vagrant documentation for more information.