I am having .a file from third-party. How can use it in android studio?
Please help me.
I am having .a file from third-party. How can use it in android studio?
Please help me.
You can not use directly a .a
library in your app. This libraries are static and Android app only allow you to load dynamic libraries.
But you can build a dynamic library linking with your static library. Si you just have to add a few line to you Android.mk to link with this static library. Put your prebuilt .a
and his header in a prebuild jni alongside your jni folder. Then your Android.mk should look like something like this :
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := YourStaticLib
LOCAL_SRC_FILES := ../prebuilt/your_static_lib_prebuild.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../prebuilt
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := DynamicLib
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../prebuilt
LOCAL_SRC_FILES := your_src_file.cpp
LOCAL_LDLIBS := -llog
LOCAL_ARM_NEON := true
LOCAL_STATIC_LIBRARIES := YourStaticLib
include $(BUILD_SHARED_LIBRARY)