Build error with ndk jni for curl

I am stuck when compiling curl with an error:

$ndk-build Android NDK: Building for application 'curl' Android NDK: Trying to define local module 'curl' in sources/curl//jni/Android.mk. Android NDK: But this module was already defined by sources/curl//jni/Android.mk. build/core/build-module.mk:34: *** Android NDK: Aborting. . Stop. 

Can someone provide the procedure you used to compile the dependencies?

+7
source share
3 answers

I had a similar error when trying to include a precompiled static library in an NDK project. I fixed it by editing the Android.mk project file to move the $(call import-module,<MY_MODULE_NAME>) line $(call import-module,<MY_MODULE_NAME>) to the very end of the file (after include $(BUILD_SHARED_LIBRARY) ).

+1
source

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_shared LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_STATIC_LIBRARY) LOCAL_SRC_FILES := $(LOCAL_PATH)/../../native_libs/$(TARGET_ARCH)/libgnustl_shared.so include $(PREBUILT_SHARED_LIBRARY) 

The conflict I received was as follows:

  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 is that I already used 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 delete the LOCAL_MODULE := libgnustl_shared from Android.mk.

0
source

I had the same problem because I used the wrong command.

in Android.mk dir, I used " ndk-build -f Android.mk ", this caused the Android NDK: Trying to define local module 'SRC' in Android.mk. problem Android NDK: Trying to define local module 'SRC' in Android.mk.
Android NDK: But this module was already defined by ...

but when I enter " ndk-build ", the build is successful!

0
source

All Articles