Build Error with ndk jni for curl
I had a similar error when trying to include a precompiled static library into a NDK project. I fixed it by editing my project's Android.mk file to move the line $(call import-module,<MY_MODULE_NAME>)
to the very end of the file (after include $(BUILD_SHARED_LIBRARY)
).
In my case, I was adding a shared library that needed gnustl_shared, so I added it to my Android.mk file:
include $(CLEAR_VARS)LOCAL_MODULE := libgnustl_sharedLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_STATIC_LIBRARY)LOCAL_SRC_FILES := $(LOCAL_PATH)/../../native_libs/$(TARGET_ARCH)/libgnustl_shared.soinclude $(PREBUILT_SHARED_LIBRARY)
The conflict I got was this:
Android NDK: Trying to define local module 'gnustl_shared' in jni/Android.mk.Android NDK: But this module was already defined by c:/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/Android.mk.
The reason was because I was already using it as a static library. This was in Application.mk:
APP_STL := gnustl_static
The solution was to change it to APP_STL := gnustl_shared
, and then to remove the LOCAL_MODULE := libgnustl_shared
section from Android.mk.
I faced the same problem because I used wrong command.
in Android.mk dir, I used "ndk-build -f Android.mk
",this was causing the problemAndroid NDK: Trying to define local module 'SRC' in Android.mk.
Android NDK: But this module was already defined by ...
but when I input "ndk-build
",build succeeded!