How to fix the error "Unused source files" in an android 6.0.1 NDK project which uese multiple prebuilt c libraries
<p>I am trying to use some c shared libraries in my android application.
The project structure is like:</p>

<pre><code>project
  |
  |---app-&gt;main.cpp, Android.mk
  |
  |---lib-&gt;|-&gt;Android.mk
           |
           |---include----|
           |              |---mylib-&gt;a.h, b.h ...
           |
           |---libs-&gt; libX.so, libY.so, libZ.so
</code></pre>

<p>In the main.cpp, I use the header files like:</p>

<pre><code>#include &lt;mylib/a.h&gt;
#include &lt;mylib/b.h&gt;
</code></pre>

<p>In the /project/app/Android.mk, I have</p>

<pre><code>LOCAL_PATH             := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE           :=  my_application
LOCAL_SHARED_LIBRARIES := the_libX_1_0_0 the_libY_1_0_0 the_libZ_0_0_9
LOCAL_SRC_FILES        := main.cpp
include $(BUILD_SHARED_LIBRARY)
</code></pre>

<p>In the /project/lib/Android.mk</p>

<pre><code>LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE                := the_libX_1_0_0
LOCAL_C_INCLUDES            := $(LOCAL_PATH)/include
LOCAL_SRC_FILES             := $(LOCAL_PATH)/libs/libX.so
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE                := the_libY_1_0_0
LOCAL_C_INCLUDES            := $(LOCAL_PATH)/include
LOCAL_SRC_FILES             := $(LOCAL_PATH)/libs/libY.so
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE                := the_libZ_0_0_9
LOCAL_C_INCLUDES            := $(LOCAL_PATH)/include
LOCAL_SRC_FILES             := $(LOCAL_PATH)/libs/libZ.so
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)
</code></pre>

<p><strong><em>[The build error]</em></strong><br>
When I try to make the application, the error I had:</p>

<pre><code>including ./Android.mk ...
build/core/binary.mk:1345: *** project/lib/Android.mk: the_libX_1_0_0: Unused source files: project/lib/libs/the_libX_1_0_0.so.
build/core/ninja.mk:155: recipe for target 'out/build-aosp_arm.ninja' failed
make: *** [out/build-aosp_arm.ninja] Error 1
</code></pre>

<hr>

<p>AOSP environment:</p>

<ul>
<li>PLATFORM_VERSION := 6.0.1 </li>
<li>PLATFORM_SDK_VERSION := 23 </li>
<li>PLATFORM_JACK_MIN_SDK_VERSION := 24</li>
</ul>

<p>Development environment:</p>

<ul>
<li>Ubuntu 16.04 LTS</li>
<li>GCC 5.4</li>
</ul>

<hr>

<p>A bit more background about the question:<br>
Actually, the library libX, libY and libZ are libcrypto.so, libssl.so and libc.so. Google uses a shrunk version of OpenSSL, I am working on an application requires the OpenSSL. So I am trying to use pre-built OpenSSL libraries here.</p>

<p>References: <br>
<a href="https://developer.android.com/ndk/guides/prebuilts.html#dm" rel="nofollow noreferrer">https://developer.android.com/ndk/guides/prebuilts.html#dm</a><br><br>
<a href="https://stackoverflow.com/questions/21922736/android-ndk-jni-building-a-shared-library-that-depends-on-other-shared-librarie">Android NDK/JNI: Building a shared library that depends on other shared libraries</a><br><br>
<a href="http://www.scriptscoop3.com/t/84e1c84496bc/android-difference-between-local-export-c-includes-and-local-c-includes.html" rel="nofollow noreferrer">http://www.scriptscoop3.com/t/84e1c84496bc/android-difference-between-local-export-c-includes-and-local-c-includes.html</a></p>