Several native Android libraries that also depend on libgnustl_shared.so

I have an Android application project that depends on two native libraries, libA and libB. libA depends on libB and both libraries are built using APP_STL: = gnustl_shared. Then there is a problem when trying to build the APK:

[2014-09-30 14:31:47 - Appname] Error generating final archive: Found duplicate file for APK: lib/armeabi/libgnustl_shared.so
Origin 1: /libA/libs/armeabi/libgnustl_shared.so
Origin 2: /libB/libs/armeabi/libgnustl_shared.so

      

How can I configure these libraries to build / link correctly when using a shared shared library like libgnustl_shared.so?

EDIT: I've tried many alternate makefile settings, so it's hard for me to know what to do here, but I'll try. Both Application.mk files in libA / jni and libB / jni contain:

APP_STL := gnustl_shared
APP_OPTIM := release
APP_ABI := armeabi-v7a armeabi
APP_PLATFORM := android-15

      

In libA / jni, the Android.mk file contains:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := MyBase
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libMyBase.so
LOCAL_PRELINK_MODULE := true
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := Base
LOCAL_SRC_FILES := Base.cpp
LOCAL_C_INCLUDES := ../../../../LIBS/MyBase/pub/include

LOCAL_LDLIBS    := -llog -ljnigraphics
LOCAL_SHARED_LIBRARIES := MyBase
LOCAL_CPP_FEATURES += rtti
LOCAL_CPP_FEATURES += exceptions
include $(BUILD_SHARED_LIBRARY)

      

In libB / jni, the Android.mk file contains:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := MyMedia
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libMyMedia.so
LOCAL_PRELINK_MODULE := true
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := Media
LOCAL_SRC_FILES := Media.cpp media_jni.cpp
LOCAL_C_INCLUDES := ../../../../LIBS/MyBase/pub/include \
                    ../../../../LIBS/MyMedia/pub/include

LOCAL_LDLIBS    := -llog -ljnigraphics
LOCAL_SHARED_LIBRARIES := MyBase MyMedia
LOCAL_CPP_FEATURES += rtti
LOCAL_CPP_FEATURES += exceptions
include $(BUILD_SHARED_LIBRARY)

$(call import-module,LIBS/MyBase/jni)

      

MyBase and MyMedia are two native libraries written in C ++ and not supported by Java / JNI. MyMedia depends on MyBase. Both libraries depend on a reliable C ++ library such as gnustl_shared.

+3
android android-ndk shared-libraries


source to share


No one has answered this question yet

See similar questions:

five
How can I eliminate duplicate C shared libraries (.so) in Multi-Project Android Build?

or similar:

3606
Close / hide Android soft keyboard
3295
Why is the Android emulator so slow? How can we speed up the development of an Android emulator?
3288
Correct use cases for Android UserManager.isUserAGoat ()?
nine
FFmpeg support for libstagefright hardware decoding
4
How to compile two different libraries in one Android.mk linking one to the other
4
error: 'to_string' is not a member of 'std'
4
Android.mk wilcard extra 'jni' on the way?
2
Add generic lib.so to android project
0
Android Studio: cannot resolve corresponding JNI function
0
Failed to create android project with ndk support



All Articles
Loading...
X
Show
Funny
Dev
Pics