blob: 6a87d2ba8a3e9910e2e3ec46b6908d1f72b77be7 [file] [log] [blame] [view]
Alexander Afanasyev087c7c12015-02-02 00:21:21 -08001NFD on Android
2==============
3
Alexander Afanasyev808ce312016-01-23 18:11:59 -08004[![Build Status](https://travis-ci.org/named-data-mobile/NFD-android.svg?branch=master)](https://travis-ci.org/named-data-mobile/NFD-android)
Alexander Afanasyev087c7c12015-02-02 00:21:21 -08005
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
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080014
15Example script for Ubuntu 14.04 to get all dependencies, download SDK and NDK:
16
Alexander Afanasyevf3812562016-01-21 16:28:33 -080017 CRYSTAX_NDK_VERSION=10.3.1
Alexander Afanasyevf3812562016-01-21 16:28:33 -080018 SDK_VERSION=24.4.1
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080019
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080020 BUILD_TOOLS_VERSION=21.1.2
21 COMPILE_SDK_VERSION=21
22
Alexander Afanasyevf3812562016-01-21 16:28:33 -080023 sudo apt-get install -y build-essential git openjdk-7-jdk unzip
24
25 # SDK binaries need i386 libraries
26 sudo dpkg --add-architecture i386;
27 sudo apt-get update -qq; sudo apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386
28
29 wget https://www.crystax.net/download/crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
30 tar xf crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
31 rm crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
32
33 wget http://dl.google.com/android/android-sdk_r$SDK_VERSION-linux.tgz
34 tar zxf android-sdk_r$SDK_VERSION-linux.tgz
35 rm android-sdk_r$SDK_VERSION-linux.tgz
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080036
37 export ANDROID_HOME=`pwd`/android-sdk-linux
38 export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
39
Alexander Afanasyevf3812562016-01-21 16:28:33 -080040 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
41 echo "y" | android update sdk --filter "android-19" --no-ui --all --force
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080042
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080043## Building
44
45
46 git clone --recursive http://gerrit.named-data.net/NFD-android
47 echo sdk.dir=`pwd`/android-sdk-linux > NFD-android/local.properties
Alexander Afanasyevf3812562016-01-21 16:28:33 -080048 echo ndk.dir=`pwd`/crystax-ndk-10.3.1 >> NFD-android/local.properties
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080049 cd NFD-android
50
Alexander Afanasyev7395caf2016-01-31 10:33:28 -080051 ./gradlew assembleRelease
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080052
53
54## Setting up environment using Vagrant
55
56The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided
57in `.vagrant/` folder. After vagrant command-line is installed, the following will create VM
58environment and fetch all necessary dependencies:
59
60 cd .vagrant
61 vagrant up
Alexander Afanasyev81e7d872015-04-19 19:38:26 -070062 vagrant ssh
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080063
64Refer to vagrant documentation for more information.