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

那年仲夏 提交于 2021-01-29 07:02:33

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/25379630/how-to-integrate-libcurl-in-native-android-project-and-build-using-ndk-on-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!