Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 1 | NFD on Android |
| 2 | ============== |
| 3 | |
Alexander Afanasyev | 808ce31 | 2016-01-23 18:11:59 -0800 | [diff] [blame] | 4 | [](https://travis-ci.org/named-data-mobile/NFD-android) |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 5 | |
| 6 | ## Prerequisites |
| 7 | |
| 8 | To compile code, the following is necessary |
| 9 | |
Alexander Afanasyev | f381256 | 2016-01-21 16:28:33 -0800 | [diff] [blame] | 10 | - 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 Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 14 | |
| 15 | Example script for Ubuntu 14.04 to get all dependencies, download SDK and NDK: |
| 16 | |
Alexander Afanasyev | f381256 | 2016-01-21 16:28:33 -0800 | [diff] [blame] | 17 | CRYSTAX_NDK_VERSION=10.3.1 |
Alexander Afanasyev | f381256 | 2016-01-21 16:28:33 -0800 | [diff] [blame] | 18 | SDK_VERSION=24.4.1 |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 19 | |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 20 | BUILD_TOOLS_VERSION=21.1.2 |
| 21 | COMPILE_SDK_VERSION=21 |
| 22 | |
Alexander Afanasyev | f381256 | 2016-01-21 16:28:33 -0800 | [diff] [blame] | 23 | 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 Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 36 | |
| 37 | export ANDROID_HOME=`pwd`/android-sdk-linux |
| 38 | export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools |
| 39 | |
Alexander Afanasyev | f381256 | 2016-01-21 16:28:33 -0800 | [diff] [blame] | 40 | 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 Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 42 | |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 43 | ## 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 Afanasyev | f381256 | 2016-01-21 16:28:33 -0800 | [diff] [blame] | 48 | echo ndk.dir=`pwd`/crystax-ndk-10.3.1 >> NFD-android/local.properties |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 49 | cd NFD-android |
| 50 | |
Alexander Afanasyev | 7395caf | 2016-01-31 10:33:28 -0800 | [diff] [blame] | 51 | ./gradlew assembleRelease |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 52 | |
| 53 | |
| 54 | ## Setting up environment using Vagrant |
| 55 | |
| 56 | The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided |
| 57 | in `.vagrant/` folder. After vagrant command-line is installed, the following will create VM |
| 58 | environment and fetch all necessary dependencies: |
| 59 | |
| 60 | cd .vagrant |
| 61 | vagrant up |
Alexander Afanasyev | 81e7d87 | 2015-04-19 19:38:26 -0700 | [diff] [blame] | 62 | vagrant ssh |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 63 | |
| 64 | Refer to vagrant documentation for more information. |