diff --git a/android/i2pd/Android.mk b/android_binary/jni/Android.mk
similarity index 98%
rename from android/i2pd/Android.mk
rename to android_binary/jni/Android.mk
index ae56110c..1c7cd92e 100755
--- a/android/i2pd/Android.mk
+++ b/android_binary/jni/Android.mk
@@ -13,7 +13,7 @@ LOCAL_STATIC_LIBRARIES := \
LOCAL_LDLIBS := -lz
LOCAL_SRC_FILES := $(IFADDRS_PATH)/ifaddrs.c \
- $(wildcard $(LIB_SRC_PATH)/*.cpp)\
+ $(wildcard $(LIB_SRC_PATH)/*.cpp)\
$(wildcard $(LIB_CLIENT_SRC_PATH)/*.cpp)\
$(DAEMON_SRC_PATH)/UnixDaemon.cpp \
$(DAEMON_SRC_PATH)/Daemon.cpp \
diff --git a/android/i2pd/Application.mk b/android_binary/jni/Application.mk
similarity index 95%
rename from android/i2pd/Application.mk
rename to android_binary/jni/Application.mk
index acc6f895..c2112d54 100755
--- a/android/i2pd/Application.mk
+++ b/android_binary/jni/Application.mk
@@ -15,7 +15,7 @@ APP_STL := gnustl_static
# Enable c++11 extensions in source code
APP_CPPFLAGS += -std=c++11 -fvisibility=default -fPIE
-APP_CPPFLAGS += -DANDROID -D__ANDROID__ -DUSE_UPNP
+APP_CPPFLAGS += -DANDROID_BINARY -DANDROID -D__ANDROID__ -DUSE_UPNP
APP_LDFLAGS += -rdynamic -fPIE -pie
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
APP_CPPFLAGS += -DANDROID_ARM7A
diff --git a/daemon/Daemon.h b/daemon/Daemon.h
index 4491d303..00baf7b9 100644
--- a/daemon/Daemon.h
+++ b/daemon/Daemon.h
@@ -64,7 +64,7 @@ namespace util
DaemonWin32 ():isGraceful(false) {}
};
-#elif defined(ANDROID)
+#elif (defined(ANDROID) && !defined(ANDROID_BINARY))
#define Daemon i2p::util::DaemonAndroid::Instance()
// dummy, invoked from android/jni/DaemonAndroid.*
class DaemonAndroid: public i2p::util::Daemon_Singleton
diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index 657e6d43..faf386d8 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -227,7 +227,7 @@ namespace http {
default: s << "Unknown";
}
s << "
\r\n";
-#if (!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID))
+#if ((!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) || defined(ANDROID_BINARY))
if (auto remains = Daemon.gracefulShutdownInterval) {
s << "Stopping in: ";
s << remains << " seconds";
@@ -504,7 +504,7 @@ namespace http {
s << " Decline transit tunnels
\r\n";
else
s << " Accept transit tunnels
\r\n";
-#if (!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID))
+#if ((!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) || defined(ANDROID_BINARY))
if (Daemon.gracefulShutdownInterval)
s << " Cancel graceful shutdown
";
else
@@ -964,14 +964,14 @@ namespace http {
i2p::context.SetAcceptsTunnels (false);
else if (cmd == HTTP_COMMAND_SHUTDOWN_START) {
i2p::context.SetAcceptsTunnels (false);
-#if (!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID))
+#if ((!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) || defined(ANDROID_BINARY))
Daemon.gracefulShutdownInterval = 10*60;
#elif defined(WIN32_APP)
i2p::win32::GracefulShutdown ();
#endif
} else if (cmd == HTTP_COMMAND_SHUTDOWN_CANCEL) {
i2p::context.SetAcceptsTunnels (true);
-#if (!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID))
+#if ((!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) || defined(ANDROID_BINARY))
Daemon.gracefulShutdownInterval = 0;
#elif defined(WIN32_APP)
i2p::win32::StopGracefulShutdown ();