Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 1 | NFD on Android |
| 2 | ============== |
| 3 | |
| 4 | [](https://travis-ci.org/named-data/NFD-android) |
| 5 | |
| 6 | ## Prerequisites |
| 7 | |
| 8 | To compile code, the following is necessary |
| 9 | |
| 10 | - Appropriate [Android SDK](http://developer.android.com/sdk/index.html) |
Alexander Afanasyev | 92bf172 | 2015-09-04 13:45:00 -0700 | [diff] [blame^] | 11 | - [CrystalX Android NDK](https://www.crystax.net/en/download) version 10.2.1 or later |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 12 | |
| 13 | Example script for Ubuntu 14.04 to get all dependencies, download SDK and NDK: |
| 14 | |
| 15 | sudo apt-get install -y build-essential git openjdk-7-jdk unzip |
Alexander Afanasyev | 92bf172 | 2015-09-04 13:45:00 -0700 | [diff] [blame^] | 16 | wget -q https://www.crystax.net/download/crystax-ndk-10.2.1-linux-x86_64.tar.bz2 |
| 17 | tar jxf crystax-ndk-10.2.1-linux-x86_64.tar.bz2 |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 18 | |
| 19 | wget -q http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz |
| 20 | tar zxf android-sdk_r24.0.2-linux.tgz |
| 21 | rm android-sdk_r24.0.2-linux.tgz |
| 22 | |
| 23 | echo y | ./android-sdk-linux/tools/android update sdk -a -u -t "android-19" |
| 24 | |
Alexander Afanasyev | 92bf172 | 2015-09-04 13:45:00 -0700 | [diff] [blame^] | 25 | wget -q https://services.gradle.org/distributions/gradle-2.6-bin.zip |
| 26 | unzip gradle-2.6-bin.zip |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 27 | |
| 28 | SDK_TOOLS_VERSION=24.0.2 |
| 29 | BUILD_TOOLS_VERSION=21.1.2 |
| 30 | COMPILE_SDK_VERSION=21 |
| 31 | |
| 32 | (sudo dpkg --add-architecture i386; sudo apt-get update -qq; sudo apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386) |
| 33 | |
| 34 | export ANDROID_HOME=`pwd`/android-sdk-linux |
| 35 | export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools |
| 36 | |
| 37 | 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 |
| 38 | |
| 39 | echo "y" | ~/android-sdk-linux/tools/android update sdk --filter "android-19" --no-ui --all --force |
| 40 | |
| 41 | ## Building |
| 42 | |
| 43 | |
| 44 | git clone --recursive http://gerrit.named-data.net/NFD-android |
| 45 | echo sdk.dir=`pwd`/android-sdk-linux > NFD-android/local.properties |
Alexander Afanasyev | 92bf172 | 2015-09-04 13:45:00 -0700 | [diff] [blame^] | 46 | echo ndk.dir=`pwd`/crystax-ndk-10.2.1 >> NFD-android/local.properties |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 47 | cd NFD-android |
| 48 | |
Alexander Afanasyev | 92bf172 | 2015-09-04 13:45:00 -0700 | [diff] [blame^] | 49 | ../gradle/gradle-2.6/bin/gradle assembleRelease |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 50 | |
| 51 | |
| 52 | ## Setting up environment using Vagrant |
| 53 | |
| 54 | The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided |
| 55 | in `.vagrant/` folder. After vagrant command-line is installed, the following will create VM |
| 56 | environment and fetch all necessary dependencies: |
| 57 | |
| 58 | cd .vagrant |
| 59 | vagrant up |
Alexander Afanasyev | 81e7d87 | 2015-04-19 19:38:26 -0700 | [diff] [blame] | 60 | vagrant ssh |
Alexander Afanasyev | 087c7c1 | 2015-02-02 00:21:21 -0800 | [diff] [blame] | 61 | |
| 62 | Refer to vagrant documentation for more information. |