Android: Import static/shared library

#1

Hi,

can somebody walk me through the import of a static library into an Android project with the Projucer?
I saw the “import static library modules” field in the android exporter but I have no idea how to use that.

I have the library and includes ready in 4 ABIs

Thanks!

#2

So far I do this (I use AWS in this example:

  1. I have the following folder structure:
    39

  2. My Android.mk in the awscore module contains this:

    LOCAL_PATH := (call my-dir) include (CLEAR_VARS)
    LOCAL_MODULE := awscore
    LOCAL_SRC_FILES := (LOCAL_PATH)/(TARGET_ARCH_ABI)/libaws-cpp-sdk-core.so
    LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include

    include $(PREBUILT_SHARED_LIBRARY)

  3. I have added the absolute path of ndk-modules as NDK_MODULE_PATH to my enviroment.

  4. I added the module names to the “Import Shared Library Modules” field of the Android exporter.

I still get the error, that the includes could not be found. The file is there. In my case:

fatal error: ‘aws/core/Aws.h’ file not found

#3

I searched the build.grade and CMakeLists.txt and for the module names I’m trying to include and can’t find any reference to it. Is it possible this has been removed by accident?

#4

Could this please somehow be fixed?
Right now I need to add something along these lines in my CMakelists and build.gradle:

CMakeLists

add_library(“aws-cpp-sdk-core” SHARED IMPORTED)
set_target_properties(“aws-cpp-sdk-core” PROPERTIES IMPORTED_LOCATION {CMAKE_SOURCE_DIR}/../../../Dependencies/aws/{ANDROID_ABI}/libaws-cpp-sdk-core.so)

CMakeLists

target_link_libraries( {BINARY_NAME} {log}
{android} {glesv2}
${egl}
“cpufeatures”
“aws-cpp-sdk-core” <-- here
“aws-cpp-sdk-sns” <-- here
)

build.gradle (the aws dir contains subdirs for each ABI)

sourceSets {
main.jniLibs.srcDirs +=
["…/…/…/Dependencies/aws"]
}

All these changes are overwritten each time I resave my projucer project.

#5

bump

#6

having the same problem …

2 Likes
#7

We have a similar problem here @tom, @ed95, @fabian any solution?

1 Like