jni+ci+build: Upgrade to use CrystaX 10.2.1

Change-Id: I7ddf71e970aefb44949aa24687ccb67552a4fd0d
diff --git a/.jenkins.d/10-get-ndk.sh b/.jenkins.d/10-get-ndk.sh
index 5729869..07f1942 100755
--- a/.jenkins.d/10-get-ndk.sh
+++ b/.jenkins.d/10-get-ndk.sh
@@ -3,7 +3,7 @@
 set -x
 
 URL=https://www.crystax.net/download/
-NDK=crystax-ndk-10.1.0
+NDK=crystax-ndk-10.2.1
 
 NDK_FILE="$NDK-linux-x86_64.tar.bz2"
 
@@ -17,7 +17,6 @@
 if [ ! -d $NDK ]; then
     echo -en 'travis_fold:start:NDK\r'
     pv -f downloads/$NDK_FILE | tar xjf -
-    find $NDK -name byteswap.h -exec sed -i -e 's/ swap/ bswap/g' {} \;
     echo -en 'travis_fold:end:NDK\r'
 fi
 
diff --git a/.jenkins.d/10-get-sdk.sh b/.jenkins.d/10-get-sdk.sh
index e17e09c..4b801dd 100644
--- a/.jenkins.d/10-get-sdk.sh
+++ b/.jenkins.d/10-get-sdk.sh
@@ -8,7 +8,7 @@
 
 export ANDROID_HOME=`pwd`/android-sdk-linux
 export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
-export PATH=$PATH:`pwd`/gradle-2.2.1/bin
+export PATH=$PATH:`pwd`/gradle-2.9/bin
 
 if [ ! -d android-sdk-linux ]; then
     wget -q http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
@@ -19,8 +19,8 @@
     echo "y" | android update sdk --filter "android-19" --no-ui --all --force
 fi
 
-wget -q https://services.gradle.org/distributions/gradle-2.2.1-bin.zip
-unzip gradle-2.2.1-bin.zip
-rm gradle-2.2.1-bin.zip
+wget -q https://services.gradle.org/distributions/gradle-2.9-bin.zip
+unzip gradle-2.9-bin.zip
+rm gradle-2.9-bin.zip
 
 echo sdk.dir=`pwd`/android-sdk-linux >> local.properties
diff --git a/.vagrant/Vagrantfile b/.vagrant/Vagrantfile
index 58a6b30..2d7b315 100644
--- a/.vagrant/Vagrantfile
+++ b/.vagrant/Vagrantfile
@@ -10,10 +10,9 @@
 sudo dpkg --add-architecture i386;
 sudo apt-get update -qq; sudo apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386
 
-wget -q https://www.crystax.net/download/crystax-ndk-10.1.0-linux-x86_64.tar.bz2
-tar jxf crystax-ndk-10.1.0-linux-x86_64.tar.bz2
-rm crystax-ndk-10.1.0-linux-x86_64.tar.bz2
-find crystax-ndk-10.1.0 -name byteswap.h -exec sed -i -e 's/ swap/ bswap/g' {} \\;
+wget -q https://www.crystax.net/download/crystax-ndk-10.2.1-linux-x86_64.tar.bz2
+tar jxf crystax-ndk-10.2.1-linux-x86_64.tar.bz2
+rm crystax-ndk-10.2.1-linux-x86_64.tar.bz2
 
 wget -q http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
 tar zxf android-sdk_r24.0.2-linux.tgz
@@ -29,13 +28,13 @@
 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
 echo "y" | android update sdk --filter "android-19" --no-ui --all --force
 
-wget -q https://services.gradle.org/distributions/gradle-2.6-bin.zip
-unzip gradle-2.6-bin.zip
-rm gradle-2.6-bin.zip
-export PATH=$PATH:`pwd`/gradle-2.6/bin
+wget -q https://services.gradle.org/distributions/gradle-2.9-bin.zip
+unzip gradle-2.9.bin.zip
+rm gradle-2.9-bin.zip
+export PATH=$PATH:`pwd`/gradle-2.9/bin
 
 echo sdk.dir=`pwd`/android-sdk-linux > local.properties
-echo ndk.dir=`pwd`/crystax-ndk-10.1.0 >> local.properties
+echo ndk.dir=`pwd`/crystax-ndk-10.2.1 >> local.properties
 SCRIPT
 
 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
diff --git a/README.md b/README.md
index fbd99b4..a0f1816 100644
--- a/README.md
+++ b/README.md
@@ -8,18 +8,13 @@
 To compile code, the following is necessary
 
 - Appropriate [Android SDK](http://developer.android.com/sdk/index.html)
-- [CrystalX Android NDK](https://www.crystax.net/en/download) version 10.1.0 or later
-
-If version 10.1.0 is used, then the following patch needs to be applied:
-
-    find crystax-ndk-10.1.0 -name byteswap.h -exec sed -i -e 's/ swap/ bswap/g' {} \;
+- [CrystalX Android NDK](https://www.crystax.net/en/download) version 10.2.1 or later
 
 Example script for Ubuntu 14.04 to get all dependencies, download SDK and NDK:
 
     sudo apt-get install -y build-essential git openjdk-7-jdk unzip
-    wget -q https://www.crystax.net/download/crystax-ndk-10.1.0-linux-x86_64.tar.bz2
-    tar jxf crystax-ndk-10.1.0-linux-x86_64.tar.bz2
-    find crystax-ndk-10.1.0 -name byteswap.h -exec sed -i -e 's/ swap/ bswap/g' {} \;
+    wget -q https://www.crystax.net/download/crystax-ndk-10.2.1-linux-x86_64.tar.bz2
+    tar jxf crystax-ndk-10.2.1-linux-x86_64.tar.bz2
 
     wget -q http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
     tar zxf android-sdk_r24.0.2-linux.tgz
@@ -27,8 +22,8 @@
 
     echo y |  ./android-sdk-linux/tools/android update sdk -a -u -t "android-19"
 
-    wget -q https://services.gradle.org/distributions/gradle-2.6-bin.zip
-    unzip gradle-2.6-bin.zip
+    wget -q https://services.gradle.org/distributions/gradle-2.9-bin.zip
+    unzip gradle-2.9-bin.zip
 
     SDK_TOOLS_VERSION=24.0.2
     BUILD_TOOLS_VERSION=21.1.2
@@ -48,10 +43,10 @@
 
     git clone --recursive http://gerrit.named-data.net/NFD-android
     echo sdk.dir=`pwd`/android-sdk-linux > NFD-android/local.properties
-    echo ndk.dir=`pwd`/crystax-ndk-10.1.0 >> NFD-android/local.properties
+    echo ndk.dir=`pwd`/crystax-ndk-10.2.1 >> NFD-android/local.properties
     cd NFD-android
 
-    ../gradle/gradle-2.6/bin/gradle assembleRelease
+    ../gradle/gradle-2.9/bin/gradle assembleRelease
 
 
 ## Setting up environment using Vagrant
diff --git a/app/src/main/jni/nfd-android/custom-logger-factory.hpp b/app/src/main/jni/nfd-android/custom-logger-factory.hpp
index 394c90b..10a961e 100644
--- a/app/src/main/jni/nfd-android/custom-logger-factory.hpp
+++ b/app/src/main/jni/nfd-android/custom-logger-factory.hpp
@@ -27,8 +27,8 @@
 
 #include "common.hpp"
 
-#include "config-file.hpp"
-#include "logger.hpp"
+#include "core/config-file.hpp"
+#include "core/logger.hpp"
 
 namespace nfd {
 
diff --git a/app/src/main/jni/nfd.mk b/app/src/main/jni/nfd.mk
index 2a63b03..76e3cc8 100644
--- a/app/src/main/jni/nfd.mk
+++ b/app/src/main/jni/nfd.mk
@@ -3,11 +3,11 @@
 
 NFD_BOOST_LIBS = system filesystem chrono program_options random thread
 
-# core
+# nfd itself
 include $(CLEAR_VARS)
-LOCAL_MODULE := nfd-core
+LOCAL_MODULE := nfd-daemon
 LOCAL_SHARED_LIBRARIES := cryptopp ndn-cxx $(addsuffix _shared,$(addprefix boost_,$(NFD_BOOST_LIBS)))
-NFD_CORE_SRC_FILES := \
+NFD_DAEMON_SRC_FILES := \
     core/city-hash.cpp \
     core/config-file.cpp \
     core/global-io.cpp \
@@ -15,20 +15,10 @@
     core/network.cpp \
     core/privilege-helper.cpp \
     core/random.cpp \
-    core/scheduler.cpp
-LOCAL_SRC_FILES := $(addprefix NFD/,$(NFD_CORE_SRC_FILES)) \
-    nfd-android/custom-logger.cpp \
-    nfd-android/custom-logger-factory.cpp
-LOCAL_CPPFLAGS := -I$(LOCAL_PATH)/nfd-android -I$(LOCAL_PATH)/NFD -I$(LOCAL_PATH)/NFD/core
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/nfd-android $(LOCAL_PATH)/NFD $(LOCAL_PATH)/NFD/core
-include $(BUILD_STATIC_LIBRARY)
-
-# nfd itself
-include $(CLEAR_VARS)
-LOCAL_MODULE := nfd-daemon
-LOCAL_SHARED_LIBRARIES := cryptopp ndn-cxx $(addsuffix _shared,$(addprefix boost_,$(NFD_BOOST_LIBS)))
-LOCAL_STATIC_LIBRARIES := nfd-core
-NFD_DAEMON_SRC_FILES := \
+    core/scheduler.cpp \
+    ../nfd-android/custom-logger.cpp \
+    ../nfd-android/custom-logger-factory.cpp \
+    \
     daemon/face/channel.cpp \
     daemon/face/face.cpp \
     daemon/face/internal-client-face.cpp \
@@ -109,6 +99,13 @@
     rib/rib.cpp \
     rib/route.cpp
 LOCAL_SRC_FILES := $(addprefix NFD/,$(NFD_DAEMON_SRC_FILES))
-LOCAL_CPPFLAGS := -I$(LOCAL_PATH)/NFD/daemon -I$(LOCAL_PATH)/NFD/rib -I$(LOCAL_PATH)/NFD/websocketpp
+LOCAL_CPPFLAGS := \
+    -I$(LOCAL_PATH)/nfd-android \
+    -I$(LOCAL_PATH)/NFD \
+    -I$(LOCAL_PATH)/NFD/core \
+    -I$(LOCAL_PATH)/NFD/daemon \
+    -I$(LOCAL_PATH)/NFD/rib \
+    -I$(LOCAL_PATH)/NFD/websocketpp
 LOCAL_LDLIBS := -llog
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/nfd-android $(LOCAL_PATH)/NFD
 include $(BUILD_SHARED_LIBRARY)
diff --git a/build.gradle b/build.gradle
index 6356aab..96a0a6d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:1.0.0'
+        classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
 
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files