Skip to content Skip to sidebar Skip to footer

Cannot Find Libxml2 In Android Ndk Project

Good day Everyone. I have wasted almost a week now figuring what's wrong when i try adding libxml2 to my android ndk project. LOCAL_PATH := $(call my-dir) #BUILDING LIBXML

Solution 1:

If you have the prebuilt static library for Android in $(LOCAL_PATH)/libxml2/libxml2.a, you can use it as is in your spice-android project,

LOCAL_STATIC_LIBRARIES += xml2

Instead of include $(BUILD_SHARED_LIBRARY) for xml2, use

LOCAL_SRC_FILES :=  libxml2/libxml2.a
include $(PREBUILT_STATIC_LIBRARY)

If you have a strong reason to use xml2 as a separate shared library, you need to add call

System.loadLibrary("xml2");

to your Java code (before loading libspice-android.so) and replace LOCAL_SRC_FILES := $(LOCAL_PATH)/libxml2/libxml2.a with

LOCAL_WHOLE_STATIC_LIBRARIES :=  $(LOCAL_PATH)/libxml2/libxml2.a

Solution 2:

This is issue of linking shared libraries, you need to add LOCAL_LDLIBS += $(LIB_PATH) -lxm2 just before LOCAL_SHARED_LIBRARIES= xml2 .


Post a Comment for "Cannot Find Libxml2 In Android Ndk Project"