I have an android application which also has c++ code dependencies.
I want to build this application as system application by compiling with AOSP.
In my android.mk, I have to first import a static library (abc.a) and then use it to build a shared library (xyz.so).
I am facing build error as "error: xyz (SHARED_LIBRARIES android-arm64) missing abc (STATIC_LIBRARIES android-arm64)"
Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := abc
LOCAL_SRC_FILES := $(LOCAL_PATH)/$(TARGET_ARCH_ABI)/abc.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
#LOCAL_LDFLAGS := -llog -ldl
LOCAL_MODULE := libxyz
LOCAL_SRC_FILES := \
xyz.cpp \
xyz1.cpp
LOCAL_STATIC_LIBRARIES := abc
LOCAL_CFLAGS += -Wall -Werror -Wno-unused-parameter -Wno-switch
#LOCAL_SDK_VERSION := 19
#LOCAL_NDK_STL_VARIANT := c++_static # LLVM libc++
include $(BUILD_SHARED_LIBRARY)
Cmakelists:
cmake_minimum_required(VERSION 3.4.1)
add_library( # Sets the name of the library.
abc
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/abc.cpp
src/main/cpp/abc.hxx
......................)
find_library( # Sets the name of the path variable.
log-lib
log pthread)
add_library( xyz
STATIC
IMPORTED )
set_target_properties( # Specifies the target library.
xyz
# Specifies the parameter you want to define.
PROPERTIES IMPORTED_LOCATION
# Provides the path to the library you want to import.
../../../../${ANDROID_ABI}/xyz.a )
target_link_libraries( # Specifies the target library.
abc
xyz ${log-lib} )
Attaching error screenshot.