blob: ff4c5fb285a5b3125318a7db0bec78089c72e3ed [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 Afanasyeva4091562016-02-23 11:51:31 -080010- Recent version of [Android SDK](http://developer.android.com/sdk/index.html), android-23 SDK
11 and 23.0.2 build tools (for build), android-19 SDK (for compatibility), and several other SDK
Alexander Afanasyevf3812562016-01-21 16:28:33 -080012 components
13- [CrystalX Android NDK](https://www.crystax.net/en/download) version 10.3.1
Alexander Afanasyeva8d404b2016-11-05 10:07:08 -060014- Prebuilt version of OpenSSL library
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
Alexander Afanasyevf3812562016-01-21 16:28:33 -080019 SDK_VERSION=24.4.1
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080020
Alexander Afanasyeva4091562016-02-23 11:51:31 -080021 BUILD_TOOLS_VERSION=23.0.2
22 COMPILE_SDK_VERSION=23
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080023
Alexander Afanasyevf3812562016-01-21 16:28:33 -080024 sudo apt-get install -y build-essential git openjdk-7-jdk unzip
Alexander Afanasyeva4091562016-02-23 11:51:31 -080025 sudo apt-get install -y lib32stdc++6 lib32z1 lib32z1-dev
Alexander Afanasyevf3812562016-01-21 16:28:33 -080026
27 wget https://www.crystax.net/download/crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
28 tar xf crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
29 rm crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
30
31 wget http://dl.google.com/android/android-sdk_r$SDK_VERSION-linux.tgz
32 tar zxf android-sdk_r$SDK_VERSION-linux.tgz
33 rm android-sdk_r$SDK_VERSION-linux.tgz
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080034
35 export ANDROID_HOME=`pwd`/android-sdk-linux
36 export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
37
Alexander Afanasyevf3812562016-01-21 16:28:33 -080038 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
39 echo "y" | android update sdk --filter "android-19" --no-ui --all --force
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080040
Alexander Afanasyeva8d404b2016-11-05 10:07:08 -060041To create prebuilt OpenSSL libraries:
42
43 git clone https://github.com/crystax/android-vendor-openssl.git
44 cd crystax-ndk-$CRYSTAX_NDK_VERSION
45 ./build/tools/build-target-openssl.sh ../android-vendor-openssl/
46
47Alternatively, you can use precompiled versions (currently, available for CrystaX NDK 10.3.1 only):
48
49 cd crystax-ndk-10.3.1/sources
50 curl -L -o openssl.tar.gz https://github.com/named-data-mobile/crystax-prebuilt-openssl/archive/crystax-10.3.1.tar.gz
51 tar zx --strip-components 1 -C openssl -f openssl.tar.gz
52 rm openssl.tar.gz
53
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080054## Building
55
56
57 git clone --recursive http://gerrit.named-data.net/NFD-android
58 echo sdk.dir=`pwd`/android-sdk-linux > NFD-android/local.properties
Alexander Afanasyevf3812562016-01-21 16:28:33 -080059 echo ndk.dir=`pwd`/crystax-ndk-10.3.1 >> NFD-android/local.properties
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080060 cd NFD-android
61
Alexander Afanasyev7395caf2016-01-31 10:33:28 -080062 ./gradlew assembleRelease
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080063
64
65## Setting up environment using Vagrant
66
67The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided
68in `.vagrant/` folder. After vagrant command-line is installed, the following will create VM
69environment and fetch all necessary dependencies:
70
71 cd .vagrant
72 vagrant up
Alexander Afanasyev81e7d872015-04-19 19:38:26 -070073 vagrant ssh
Alexander Afanasyev087c7c12015-02-02 00:21:21 -080074
75Refer to vagrant documentation for more information.