Eshan
Eshan

Reputation: 133

How to integrate libcurl in native android project and build using ndk on windows?

I want to use libcurl in my native project. How can I integrate this library and build using ndk? Is there any post available that can guide me through the process?

I tried the docs from official site, but that's not working. FYI I am on windows platform.

Upvotes: 0

Views: 2906

Answers (2)

G3M
G3M

Reputation: 1031

Create a JNI folder within your project and add a folder for each architecture(arm, armv7,x86 etc). Place the corresponding libcurl.so files in the respective folders. Since this is a rebuilt shared binary you need to add this to your Android.mk file

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := <Curl> //add the module name here. 
LOCAL_SRC_FILES := <libCurl.so> //add the .so file name here
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../jni/include

include $(PREBUILT_SHARED_LIBRARY)

Create a JNI C file that uses the libraries from Curl and call the native code from Java source.

static {


        System.loadLibrary("curl");

    }

It shouldnt make a difference if you are on Windows platform. Adding open source liv files to Android NDK is pretty much the same process on all platforms.

Upvotes: 3

18446744073709551615
18446744073709551615

Reputation: 16852

No idea about windows, but as to the linker magic, see the links in Integrating MuPDF as a library project (Android)

Upvotes: 0

Related Questions