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/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 \