Upgrade dependencies and build system

This commit switches to use official Google NDK version 16 with packages
created/installed using android-crew-staging tool derived from CrystaX
project.

Change-Id: I248fef2a871e44375512dcbf15a5f3166c0ab5de
diff --git a/.gitmodules b/.gitmodules
index 96a2d18..62d1207 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,8 +4,9 @@
     branch = android
 [submodule "app/src/main/jni/ndn-cxx"]
     path = app/src/main/jni/ndn-cxx
-    url = https://github.com/cawka/ndn-cxx
+    url = https://github.com/named-data-mobile/ndn-cxx
     branch = 0.5.0-android-hotfix
 [submodule "app/src/main/jni/NFD"]
     path = app/src/main/jni/NFD
-    url = https://github.com/named-data/NFD
+    url = https://github.com/named-data-mobile/NFD
+    branch = master
diff --git a/.jenkins b/.jenkins
new file mode 100755
index 0000000..674d751
--- /dev/null
+++ b/.jenkins
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+set -e
+
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+for file in "$DIR"/.jenkins.d/*; do
+    [[ -f $file && -x $file ]] || continue
+    echo "Run: $file"
+    "$file"
+done
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index 056626b..1673813 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -2,9 +2,5 @@
 set -e
 set -x
 
-echo -en 'travis_fold:start:deps\r'
-
-sudo apt-get install -y build-essential git openjdk-7-jdk unzip
+sudo apt-get install -y build-essential git openjdk-8-jdk unzip ruby ruby-rugged
 sudo apt-get install -y lib32stdc++6 lib32z1 lib32z1-dev
-
-echo -en 'travis_fold:end:deps\r'
diff --git a/.jenkins.d/10-get-ndk.sh b/.jenkins.d/10-get-ndk.sh
deleted file mode 100755
index c1cfe24..0000000
--- a/.jenkins.d/10-get-ndk.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env bash
-set -e
-set -x
-
-CRYSTAX_NDK_VERSION=10.3.1
-
-URL=https://www.crystax.net/download/
-NDK=crystax-ndk-$CRYSTAX_NDK_VERSION
-
-NDK_FILE="$NDK-linux-x86_64.tar.xz"
-
-if [ ! -f downloads/$NDK_FILE ]; then
-    mkdir downloads || true
-    cd downloads
-    wget --no-check-certificate $URL$NDK_FILE
-    cd ..
-fi
-
-if [ ! -d $NDK ]; then
-    export XZ_DEFAULTS=--memlimit=300MiB
-    echo -en 'travis_fold:start:NDK\r'
-
-    # To save space
-    EXCLUDES="toolchains/*-clang3.6 toolchains/*-3.6 \
-            toolchains/*-clang3.7 \
-            toolchains/*-3.7 \
-            toolchains/*-4.9 \
-            sources/cxx-stl/gabi++ \
-            sources/cxx-stl/llvm-libc++ \
-            sources/cxx-stl/llvm-libc++abi \
-            sources/cxx-stl/stlport \
-            sources/cxx-stl/llvm-libc++ \
-            sources/cxx-stl/gnu-libstdc++/4.9 \
-            sources/icu \
-            sources/boost/*/libs/*/gnu-4.9 \
-            sources/boost/*/libs/*/llvm-3.6 \
-            sources/boost/*/libs/*/llvm-3.7 \
-            sources/objc \
-            sources/python"
-
-    pv -f downloads/$NDK_FILE | tar xJf - $(for i in $EXCLUDES; do echo "--exclude $i"; done | xargs)
-    echo -en 'travis_fold:end:NDK\r'
-fi
-
-echo ndk.dir=`pwd`/$NDK >> local.properties
-
-cd crystax-ndk-$CRYSTAX_NDK_VERSION/sources
-curl -L -o openssl.tar.gz https://github.com/named-data-mobile/crystax-prebuilt-openssl/archive/crystax-$CRYSTAX_NDK_VERSION.tar.gz
-tar zx --strip-components 1 -C openssl -f openssl.tar.gz
-rm openssl.tar.gz
-cd ../..
diff --git a/.jenkins.d/10-get-sdk.sh b/.jenkins.d/10-get-sdk.sh
index 87418ba..2780c32 100755
--- a/.jenkins.d/10-get-sdk.sh
+++ b/.jenkins.d/10-get-sdk.sh
@@ -2,22 +2,20 @@
 set -e
 set -x
 
-SDK_VERSION=24.4.1
-BUILD_TOOLS_VERSION=26.0.0
-COMPILE_SDK_VERSION=26
-
 SDK=android-sdk-linux
 
-export ANDROID_HOME=`pwd`/$SDK
-export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
+mkdir -p $SDK
+cd $SDK
+wget -q https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
+unzip sdk-tools-linux-3859397.zip
+rm sdk-tools-linux-3859397.zip
 
-if [ ! -d $SDK ]; then
-    wget -nv http://dl.google.com/android/android-sdk_r$SDK_VERSION-linux.tgz
-    tar zxf android-sdk_r$SDK_VERSION-linux.tgz
-    rm android-sdk_r$SDK_VERSION-linux.tgz
+export ANDROID_HOME=`pwd`
+export PATH=${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
 
-    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
-fi
+echo "y" | sdkmanager "platform-tools"
+sdkmanager "platforms;android-26" "build-tools;26.0.3"
+
+cd ..
 
 echo sdk.dir=`pwd`/$SDK >> local.properties
diff --git a/.jenkins.d/20-get-ndk.sh b/.jenkins.d/20-get-ndk.sh
new file mode 100755
index 0000000..6548c94
--- /dev/null
+++ b/.jenkins.d/20-get-ndk.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+set -e
+set -x
+
+android-sdk-linux/tools/bin/sdkmanager "ndk-bundle"
+git clone https://github.com/cawka/android-crew-staging.git android-sdk-linux/ndk-bundle/crew.dir
+
+if [[ ! -z $GEM_PATH ]]; then
+    # Hack for unset GEM_PATH in crew tool
+    ORIG_RUBY=`which ruby`
+    echo '#!/usr/bin/env bash' > ruby
+    echo "export GEM_HOME=$GEM_HOME" >> ruby
+    echo "export GEM_PATH=$GEM_PATH" >> ruby
+    echo "exec $ORIG_RUBY \$@" >> ruby
+    chmod 755 ruby
+
+    export CREW_TOOLS_DIR=`pwd`
+    export PATH=`pwd`:$PATH
+fi
+
+export CREW_OWNER=cawka
+# export CREW_DOWNLOAD_BASE=http://irl.cs.ucla.edu/~cawka/android-crew-staging/staging/
+
+android-sdk-linux/ndk-bundle/crew.dir/crew install target/sqlite:3.18.0 target/openssl:1.0.2m target/boost:1.65.1
+
+echo ndk.dir=`pwd`/android-sdk-linux/ndk-bundle >> local.properties
diff --git a/.travis.yml b/.travis.yml
index 08520ae..bfc648b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
 sudo: false
 language: generic
 jdk:
-  - openjdk7
+  - openjdk8
 notifications:
   email:
     on_success: always
@@ -10,12 +10,10 @@
   global:
     - TERM=dumb
     - GRADLE_OPTS="-Xmx768m -Xms256m -Xss1m"
-    - NDK_BUILD_PARALLEL=1
+    - NDK_BUILD_PARALLEL=2
   matrix:
     - NDK_BUILD_ABI=arm64-v8a
-    - NDK_BUILD_ABI=armeabi
     - NDK_BUILD_ABI=armeabi-v7a
-    - NDK_BUILD_ABI=mips
     - NDK_BUILD_ABI=x86
     - NDK_BUILD_ABI=x86_64
 addons:
@@ -28,16 +26,9 @@
      - wget
      - unzip
 before_install:
-  - wget https://www.ivarch.com/programs/sources/pv-1.6.0.tar.bz2
-  - tar xjf pv-1.6.0.tar.bz2
-  - cd pv-1.6.0
-  - ./configure --prefix=$HOME --disable-nls
-  - make install
-  - cd ..
-  - rm pv-1.6.0.tar.bz2
-  - export PATH=$HOME/bin:$PATH
   - travis_retry .jenkins.d/10-get-sdk.sh
-  - travis_retry .jenkins.d/10-get-ndk.sh
+  - gem install rugged
+  - travis_retry .jenkins.d/20-get-ndk.sh
 script:
   - git submodule update --init --recursive
   - ./gradlew assembleDebug
diff --git a/.vagrant/Vagrantfile b/.vagrant/Vagrantfile
index a5182c9..0423794 100644
--- a/.vagrant/Vagrantfile
+++ b/.vagrant/Vagrantfile
@@ -4,43 +4,40 @@
 VAGRANTFILE_API_VERSION = "2"
 
 $script = <<SCRIPT
+    export DEBIAN_FRONTEND=noninteractive
 
-CRYSTAX_NDK_VERSION=10.3.1
+    sudo apt-mark hold grub-pc
+    sudo apt -q -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" update
+    sudo apt -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
+    sudo apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" build-essential git openjdk-8-jdk unzip ruby ruby-rugged
+    sudo apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" lib32stdc++6 lib32z1 lib32z1-dev
 
-SDK_VERSION=24.4.1
-BUILD_TOOLS_VERSION=23.0.2
-COMPILE_SDK_VERSION=23
+    mkdir android-sdk-linux
+    cd android-sdk-linux
+    wget -q https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
+    unzip sdk-tools-linux-3859397.zip
+    rm sdk-tools-linux-3859397.zip
 
-sudo apt -q update
-sudo apt -qy upgrade
-sudo apt install -y build-essential git openjdk-8-jdk unzip
-sudo apt install -y lib32stdc++6 lib32z1 lib32z1-dev
+    export ANDROID_HOME=`pwd`
+    export PATH=${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
 
-wget -nv https://www.crystax.net/download/crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
-tar xf crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
-rm crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
+    echo "y" | sdkmanager "platform-tools"
+    sdkmanager "platforms;android-26" "build-tools;26.0.3" "ndk-bundle"
 
-wget -nv http://dl.google.com/android/android-sdk_r$SDK_VERSION-linux.tgz
-tar zxf android-sdk_r$SDK_VERSION-linux.tgz
-rm android-sdk_r$SDK_VERSION-linux.tgz
+    cd ndk-bundle
+    git clone https://github.com/cawka/android-crew-staging.git crew.dir
 
-export ANDROID_HOME=`pwd`/android-sdk-linux
-export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
+    CREW_OWNER=cawka crew.dir/crew install target/sqlite:3.18.0 target/openssl:1.0.2m target/boost:1.65.1
 
-echo "y" | android update sdk --filter platform-tools,build-tools-$BUILD_TOOLS_VERSION,android-$COMPILE_SDK_VERSION,extra-android-m2repository,extra-google-m2repository --no-ui --all --force
-echo "y" | android update sdk --filter "android-19" --no-ui --all --force
+    cd ../..
 
-echo sdk.dir=`pwd`/android-sdk-linux > local.properties
-echo ndk.dir=`pwd`/crystax-ndk-$CRYSTAX_NDK_VERSION >> local.properties
+    echo sdk.dir=`pwd`/android-sdk-linux > local.properties
+    echo ndk.dir=`pwd`/android-sdk-linux/ndk-bundle >> local.properties
 
-cd crystax-ndk-$CRYSTAX_NDK_VERSION/sources
-curl -s -L -o openssl.tar.gz https://github.com/named-data-mobile/crystax-prebuilt-openssl/archive/crystax-$CRYSTAX_NDK_VERSION.tar.gz
-tar zx --strip-components 1 -C openssl -f openssl.tar.gz
-rm openssl.tar.gz
 SCRIPT
 
 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
-  config.vm.box = "boxcutter/ubuntu1604"
+  config.vm.box = "puphpet/ubuntu1604-x64"
 
   config.vm.provision "shell", privileged: false, inline: $script
 
diff --git a/README.md b/README.md
index 5bf920e..af28fd9 100644
--- a/README.md
+++ b/README.md
@@ -7,65 +7,57 @@
 
 To compile code, the following is necessary
 
-- Recent version of [Android SDK](http://developer.android.com/sdk/index.html), android-23 SDK
-  and 23.0.2 build tools (for build), android-19 SDK (for compatibility), and several other SDK
-  components
-- [CrystalX Android NDK](https://www.crystax.net/en/download) version 10.3.1
-- Prebuilt version of OpenSSL library
+- Recent version of [Android SDK](http://developer.android.com/sdk/index.html)
 
 Example script for Ubuntu 16.04 to get all dependencies, download SDK and NDK:
 
-    CRYSTAX_NDK_VERSION=10.3.1
-    SDK_VERSION=24.4.1
-    OPENSSL_VERSION=1.0.2h
-
-    BUILD_TOOLS_VERSION=23.0.2
-    COMPILE_SDK_VERSION=23
-
     sudo apt -q update
     sudo apt -qy upgrade
-    sudo apt-get install -y build-essential git openjdk-8-jdk unzip
+    sudo apt-get install -y build-essential git openjdk-8-jdk unzip ruby ruby-rugged
     sudo apt-get install -y lib32stdc++6 lib32z1 lib32z1-dev
 
-    wget https://www.crystax.net/download/crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
-    tar xf crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
-    rm crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
+    mkdir android-sdk-linux
+    cd android-sdk-linux
+    wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
+    unzip sdk-tools-linux-3859397.zip
+    rm sdk-tools-linux-3859397.zip
 
-    wget http://dl.google.com/android/android-sdk_r$SDK_VERSION-linux.tgz
-    tar zxf android-sdk_r$SDK_VERSION-linux.tgz
-    rm android-sdk_r$SDK_VERSION-linux.tgz
+    export ANDROID_HOME=`pwd`
+    export PATH=${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
 
-    export ANDROID_HOME=`pwd`/android-sdk-linux
-    export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
+    echo "y" | sdkmanager "platform-tools"
+    sdkmanager "platforms;android-26" "build-tools;26.0.3" "ndk-bundle"
 
-    echo "y" | android update sdk --filter platform-tools,build-tools-$BUILD_TOOLS_VERSION,android-$COMPILE_SDK_VERSION,extra-android-m2repository,extra-google-m2repository --no-ui --all --force
-    echo "y" | android update sdk --filter "android-19" --no-ui --all --force
+    cd ndk-bundle
+    git clone https://github.com/cawka/android-crew-staging.git crew.dir
 
-To create prebuilt OpenSSL libraries:
+    CREW_OWNER=cawka crew.dir/crew install target/sqlite:3.18.0 target/openssl:1.0.2m target/boost:1.65.1
 
-    git clone https://github.com/crystax/android-vendor-openssl.git
-    cd crystax-ndk-$CRYSTAX_NDK_VERSION
-    ./build/tools/build-target-openssl.sh ../android-vendor-openssl/
-    cp sources/openssl/1.0.1p/Android.mk -o sources/openssl/$OPENSSL_VERSION/Android.mk
+    cd ..
 
-Alternatively, you can use precompiled versions (currently, available for CrystaX NDK 10.3.1 only):
-
-    cd crystax-ndk-10.3.1/sources
-    curl -L -o openssl.tar.gz https://github.com/named-data-mobile/crystax-prebuilt-openssl/archive/crystax-10.3.1.tar.gz
-    tar zx --strip-components 1 -C openssl -f openssl.tar.gz
-    rm openssl.tar.gz
+The above `crew` scripts will install pre-compiled versions of sqlite, openssl, and boost libraries.
+To compile them instead, replace `install` with `build`.
 
 ## Building
 
 
     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.3.1 >> NFD-android/local.properties
+    echo ndk.dir=`pwd`/android-sdk-linux/ndk-bundle >> NFD-android/local.properties
     cd NFD-android
 
     ./gradlew assembleRelease
 
 
+Note that you can limit architectures being built using `NDK_BUILD_ABI` variable.  For example,
+
+    export NDK_BUILD_ABI=armeabi-v7a,x86_64
+
+will limit build to `armeabi-v7a` and `x86_64`.
+
+By default, the build script will try to parallelize build to the number of CPUs.  This can be
+overridden using `NDK_BUILD_PARALLEL` variable.
+
 ## Setting up environment using Vagrant
 
 The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided
diff --git a/app/build.gradle b/app/build.gradle
index 909fae0..d5eb0bf 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -4,14 +4,15 @@
 
 android {
     compileSdkVersion 26
-    buildToolsVersion "26.0.0"
+    buildToolsVersion "26.0.3"
 
     defaultConfig {
         applicationId "net.named_data.nfd"
-        minSdkVersion 15
-        targetSdkVersion 19
-        versionCode 4004
-        versionName "0.2.4 (NFD 0.5.0, ndn-cxx 0.5.0-11-g1cf4146e)"
+        minSdkVersion 23
+        targetSdkVersion 23
+        versionCode 4005
+        versionName "0.2.5 (NFD 0.5.0, ndn-cxx 0.5.0-11-g1cf4146e)"
+        multiDexEnabled true
     }
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_7
@@ -19,7 +20,7 @@
     }
     buildTypes {
         release {
-            minifyEnabled false
+            minifyEnabled true
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
         }
         debug {
@@ -41,6 +42,9 @@
         exclude 'META-INF/LICENSE.txt'
         exclude 'META-INF/NOTICE.txt'
     }
+    lintOptions {
+      abortOnError false
+    }
 
     splits {
         abi {
@@ -51,11 +55,11 @@
 
     // map for the version code
     // versionCode digit for each supported ABI, with 64bit>32bit and x86>armeabi-*
-    project.ext.versionCodes = ['armeabi': 1,
+    project.ext.versionCodes = [//'armeabi': 1, // Deprecated in r16. Will be removed in r17. No hard float.
                                 'armeabi-v7a': 2,
                                 'arm64-v8a': 3,
-                                'mips': 5,
-                                'mips64': 6,
+                                // 'mips': 5,   // Deprecated in r16. Will be removed in r17. Uses hard-float, and assumes a CPU:FPU clock ratio of 2:1 for maximum compatibility. Provides neither micromips nor MIPS16.
+                                // 'mips64': 6, // Deprecated in r16. WIll be removed in r17
                                 'x86': 8,
                                 'x86_64': 9]
 
@@ -93,7 +97,7 @@
         }
 
         if (System.env.NDK_DEBUG != null) {
-           args.add("NDK_DEBUG=1")
+           args.add("V=1")
         }
         commandLine args
     }
@@ -142,18 +146,19 @@
 }
 
 dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
-    compile 'com.android.support:appcompat-v7:23.1.1'
-    compile 'com.android.support:support-v4:23.1.1'
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+    implementation 'com.android.support:appcompat-v7:26.1.0'
+    implementation 'com.android.support:support-v4:26.1.0'
 
-    compile('com.intel.jndn.management:jndn-management:1.1.0') {
+    implementation('com.intel.jndn.management:jndn-management:1.1.3') {
       exclude group: 'net.named-data', module: 'jndn'
     }
-    compile('net.named-data:jndn-android:0.14') {
+    implementation('net.named-data:jndn-android:0.15') {
       exclude group: 'org.xerial'
+      exclude group: 'com.google.android'
     }
-    compile 'net.named-data.jndn-xx:jndn-xx-util:0.0.1'
-    compile 'joda-time:joda-time:2.7'
+    implementation 'net.named-data.jndn-xx:jndn-xx-util:0.0.1'
+    implementation 'joda-time:joda-time:2.9.9'
 }
 
 Properties properties = new Properties()
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 314d8a4..7b070a9 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1,8 +1,115 @@
-# The simpliest strategy is to not run proguard against your project's own code.
-# This doesn't provide the benefits of optimization & obfuscation against your
-# project, but will still strip the libraries. The advantage is that your app will
-# work without any subsequent effort. If you choose this strategy, the proguard
-# configuration for the project is simply the line below.
+#-dontshrink
+#-dontoptimize
+#-dontpreverify
+-verbose
+-dontwarn javax.annotation.**
+-dontwarn com.google.**
+-dontwarn org.joda.convert.**
 
-# -keep class net.named_data.nfd.** { * ; }
-# -keep class net.named_data.jndn.** { * ; }
+-dontnote org.sqlite.JDBC
+-dontnote javax.xml.bind.DatatypeConverter
+-dontnote com.google.appengine.api.ThreadManager
+-dontnote com.google.apphosting.api.ApiProxy
+
+#
+
+-renamesourcefileattribute SourceFile
+
+-keepattributes SourceFile,LineNumberTable
+
+# RemoteViews might need annotations.
+
+-keepattributes *Annotation*
+
+# Preserve all fundamental application classes.
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+
+# Preserve all View implementations, their special context constructors, and
+# their setters.
+
+-keep public class * extends android.view.View {
+    public <init>(android.content.Context);
+    public <init>(android.content.Context, android.util.AttributeSet);
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+    public void set*(...);
+}
+
+# Preserve all classes that have special context constructors, and the
+# constructors themselves.
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+# Preserve all classes that have special context constructors, and the
+# constructors themselves.
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+# Preserve the special fields of all Parcelable implementations.
+
+-keepclassmembers class * implements android.os.Parcelable {
+    static android.os.Parcelable$Creator CREATOR;
+}
+
+# Preserve static fields of inner classes of R classes that might be accessed
+# through introspection.
+
+-keepclassmembers class **.R$* {
+  public static <fields>;
+}
+
+# Preserve the required interface from the License Verification Library
+# (but don't nag the developer if the library is not used at all).
+
+-keep public interface com.android.vending.licensing.ILicensingService
+
+-dontnote com.android.vending.licensing.ILicensingService
+
+# The Android Compatibility library references some classes that may not be
+# present in all versions of the API, but we know that's ok.
+
+-dontwarn android.support.**
+
+# Preserve all native method names and the names of their classes.
+
+-keepclasseswithmembernames class * {
+    native <methods>;
+}
+
+# Preserve the special static methods that are required in all enumeration
+# classes.
+
+-keepclassmembers class * extends java.lang.Enum {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+# Explicitly preserve all serialization members. The Serializable interface
+# is only a marker interface, so it wouldn't save them.
+# You can comment this out if your application doesn't use serialization.
+# If your code contains serializable classes that have to be backward
+# compatible, please refer to the manual.
+
+-keepclassmembers class * implements java.io.Serializable {
+    static final long serialVersionUID;
+    static final java.io.ObjectStreamField[] serialPersistentFields;
+    private void writeObject(java.io.ObjectOutputStream);
+    private void readObject(java.io.ObjectInputStream);
+    java.lang.Object writeReplace();
+    java.lang.Object readResolve();
+}
+
+# Your application may contain more items that need to be preserved;
+# typically classes that are dynamically created using Class.forName:
+
+# -keep public class mypackage.MyClass
+# -keep public interface mypackage.MyInterface
+# -keep public class * implements mypackage.MyInterface
diff --git a/app/src/main/java/net/named_data/nfd/DrawerFragment.java b/app/src/main/java/net/named_data/nfd/DrawerFragment.java
index bf8e29d..60144a0 100644
--- a/app/src/main/java/net/named_data/nfd/DrawerFragment.java
+++ b/app/src/main/java/net/named_data/nfd/DrawerFragment.java
@@ -1,6 +1,6 @@
 /* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2015 Regents of the University of California
+ * Copyright (c) 2015-2017 Regents of the University of California
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
  * See AUTHORS.md for complete list of NFD Android authors and contributors.
@@ -33,8 +33,8 @@
 import android.support.v4.widget.DrawerLayout;
 import android.support.v4.widget.ViewDragHelper;
 import android.support.v7.app.ActionBar;
-import android.support.v7.app.ActionBarActivity;
 import android.support.v7.app.ActionBarDrawerToggle;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -334,7 +334,7 @@
    * @return Host activity's ActionBar.
    */
   private ActionBar getActionBar() {
-    return ((ActionBarActivity)getActivity()).getSupportActionBar();
+    return ((AppCompatActivity)getActivity()).getSupportActionBar();
   }
 
   //////////////////////////////////////////////////////////////////////////////
diff --git a/app/src/main/java/net/named_data/nfd/MainActivity.java b/app/src/main/java/net/named_data/nfd/MainActivity.java
index ee19928..c3a13ba 100644
--- a/app/src/main/java/net/named_data/nfd/MainActivity.java
+++ b/app/src/main/java/net/named_data/nfd/MainActivity.java
@@ -24,7 +24,7 @@
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
 import android.support.v7.app.ActionBar;
-import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.AppCompatActivity;
 import android.view.Menu;
 import android.view.MenuItem;
 
@@ -39,7 +39,7 @@
 /**
  * Main activity that is loaded for the NFD app.
  */
-public class MainActivity extends ActionBarActivity
+public class MainActivity extends AppCompatActivity
     implements DrawerFragment.DrawerCallbacks,
                LogcatFragment.Callbacks,
                FaceListFragment.Callbacks,
diff --git a/app/src/main/java/net/named_data/nfd/service/NfdService.java b/app/src/main/java/net/named_data/nfd/service/NfdService.java
index 3ab102d..1b2d4e4 100644
--- a/app/src/main/java/net/named_data/nfd/service/NfdService.java
+++ b/app/src/main/java/net/named_data/nfd/service/NfdService.java
@@ -1,6 +1,6 @@
 /* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2015 Regents of the University of California
+ * Copyright (c) 2015-2017 Regents of the University of California
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
  * See AUTHORS.md for complete list of NFD Android authors and contributors.
@@ -54,30 +54,29 @@
   static {
     // At least on Galaxy S3 (4.1.1), all shared library dependencies that are located
     // in app's lib folder (not in /system/lib) need to be explicitly loaded.
-    // The script https://gist.github.com/cawka/11fe9c23b7a13960330b can be used to
-    // calculate proper dependency load list.
+    // Use `ndk-depends` to automatically generate this list.
     // For example:
     //     cd app/src/main/libs/armeabi-v7a/
     //     bash android-shared-lib-dependencies.sh nfd-wrapper
-    System.loadLibrary("crystax");
-    System.loadLibrary("gnustl_shared");
-    System.loadLibrary("cryptopp_shared");
-    System.loadLibrary("boost_system");
-    System.loadLibrary("boost_filesystem");
-    System.loadLibrary("boost_date_time");
-    System.loadLibrary("boost_iostreams");
-    System.loadLibrary("boost_program_options");
-    System.loadLibrary("boost_chrono");
-    System.loadLibrary("boost_random");
-    System.loadLibrary("ndn-cxx");
-    System.loadLibrary("boost_thread");
-    System.loadLibrary("nfd-daemon");
+    // System.loadLibrary("crystax");
+    // System.loadLibrary("gnustl_shared");
+    // System.loadLibrary("cryptopp_shared");
+    // System.loadLibrary("boost_system");
+    // System.loadLibrary("boost_filesystem");
+    // System.loadLibrary("boost_date_time");
+    // System.loadLibrary("boost_iostreams");
+    // System.loadLibrary("boost_program_options");
+    // System.loadLibrary("boost_chrono");
+    // System.loadLibrary("boost_random");
+    // System.loadLibrary("ndn-cxx");
+    // System.loadLibrary("boost_thread");
+    // System.loadLibrary("nfd-daemon");
     System.loadLibrary("nfd-wrapper");
   }
 
   /**
    * Native API for starting the NFD.
-   *
+   * <p/>
    * @param params NFD parameters.  Must include 'homePath' with absolute path of the home directory
    *               for the service (ContextWrapper.getFilesDir().getAbsolutePath())
    */
diff --git a/app/src/main/jni/Android.mk b/app/src/main/jni/Android.mk
index 4ab6a50..20989c2 100644
--- a/app/src/main/jni/Android.mk
+++ b/app/src/main/jni/Android.mk
@@ -10,5 +10,3 @@
 
 include $(LOCAL_PATH_SAVED)/ndn-cxx.mk
 include $(LOCAL_PATH_SAVED)/nfd.mk
-
-$(call import-module,boost/1.59.0)
diff --git a/app/src/main/jni/Application.mk b/app/src/main/jni/Application.mk
index 976b943..793e7c4 100644
--- a/app/src/main/jni/Application.mk
+++ b/app/src/main/jni/Application.mk
@@ -1,7 +1,8 @@
-APP_ABI := all
+APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
 
 APP_STL := gnustl_shared
-APP_CPPFLAGS += -fexceptions -frtti -std=c++11 -Wno-deprecated-declarations
+APP_CPPFLAGS += -fexceptions -frtti -std=c++11
+# -Wno-deprecated-declarations
 
-NDK_TOOLCHAIN_VERSION := 5
-APP_PLATFORM := android-19
+NDK_TOOLCHAIN_VERSION := 4.9
+APP_PLATFORM := android-23
diff --git a/app/src/main/jni/ndn-cxx b/app/src/main/jni/ndn-cxx
index 1cf4146..17c83c2 160000
--- a/app/src/main/jni/ndn-cxx
+++ b/app/src/main/jni/ndn-cxx
@@ -1 +1 @@
-Subproject commit 1cf4146eb9d5ea5604072e096bf11e2dffa136eb
+Subproject commit 17c83c2467dd468dfa8684cc9f5412dc1b7c59dd
diff --git a/app/src/main/jni/ndn-cxx-android/ndn-cxx-config.hpp b/app/src/main/jni/ndn-cxx-android/ndn-cxx-config.hpp
index f669a93..d7d1858 100644
--- a/app/src/main/jni/ndn-cxx-android/ndn-cxx-config.hpp
+++ b/app/src/main/jni/ndn-cxx-android/ndn-cxx-config.hpp
@@ -1,7 +1,7 @@
 #ifndef W_SRC_NDN_CXX_CONFIG_HPP_WAF
 #define W_SRC_NDN_CXX_CONFIG_HPP_WAF
 
-#define NDN_CXX_HAVE_STD_TO_STRING 1
+// #define NDN_CXX_HAVE_STD_TO_STRING 1
 #define NDN_CXX_HAVE_VECTOR_INSERT_ERASE_CONST_ITERATOR 1
 #define NDN_CXX_HAVE_IS_DEFAULT_CONSTRUCTIBLE 1
 #define NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE 1
diff --git a/app/src/main/jni/ndn-cxx.mk b/app/src/main/jni/ndn-cxx.mk
index d467bac..b47ea5c 100644
--- a/app/src/main/jni/ndn-cxx.mk
+++ b/app/src/main/jni/ndn-cxx.mk
@@ -4,7 +4,7 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE := ndn-cxx
 NDN_CXX_BOOST_LIBS = system filesystem date_time iostreams program_options chrono random
-LOCAL_SHARED_LIBRARIES := cryptopp_shared opencrypto_shared openssl_shared $(addsuffix _shared,$(addprefix boost_,$(NDN_CXX_BOOST_LIBS)))
+LOCAL_SHARED_LIBRARIES := cryptopp_shared libcrypto_shared libssl_shared $(addsuffix _shared,$(addprefix boost_,$(NDN_CXX_BOOST_LIBS)))
 LOCAL_STATIC_LIBRARIES := sqlite3_static boost_regex_static
 NDN_CXX_SRC_FILES := \
     data.cpp \
@@ -145,6 +145,6 @@
 
 include $(LOCAL_PATH_SAVED)/cryptopp/extras/jni/Android.mk
 
-$(call import-module,boost/1.59.0)
-$(call import-module,sqlite/3)
-$(call import-module,openssl/1.0.2h)
+$(call import-module,../packages/boost/1.65.1)
+$(call import-module,../packages/sqlite/3.18.0)
+$(call import-module,../packages/openssl/1.0.2m)
diff --git a/app/src/main/jni/nfd.mk b/app/src/main/jni/nfd.mk
index c8e6818..77c27b8 100644
--- a/app/src/main/jni/nfd.mk
+++ b/app/src/main/jni/nfd.mk
@@ -6,7 +6,7 @@
 # nfd itself
 include $(CLEAR_VARS)
 LOCAL_MODULE := nfd-daemon
-LOCAL_SHARED_LIBRARIES := cryptopp_shared openssl_shared ndn-cxx $(addsuffix _shared,$(addprefix boost_,$(NFD_BOOST_LIBS)))
+LOCAL_SHARED_LIBRARIES := cryptopp_shared libcrypto_shared libssl_shared ndn-cxx $(addsuffix _shared,$(addprefix boost_,$(NFD_BOOST_LIBS)))
 NFD_DAEMON_SRC_FILES := \
     core/city-hash.cpp \
     core/config-file.cpp \
diff --git a/build.gradle b/build.gradle
index 73d0250..cf440d0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,13 +2,14 @@
 
 buildscript {
     repositories {
+        google()
         jcenter()
         maven {
             url "https://oss.sonatype.org/content/repositories/snapshots/"
         }
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:2.3.3'
+        classpath 'com.android.tools.build:gradle:3.0.1'
         classpath 'net.named-data.playground:play-publisher:1.2.0-2-SNAPSHOT'
 
         // NOTE: Do not place your application dependencies here; they belong
@@ -18,6 +19,11 @@
 
 allprojects {
     repositories {
+        google()
         jcenter()
     }
 }
+
+task clean(type: Delete) {
+    delete rootProject.buildDir
+}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 29be96d..6b55714 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Jul 07 17:24:15 PDT 2017
+#Sun Nov 12 15:16:12 EST 2017
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip