1

I have two android projects with native support, that's to say, they're both android project and c++ project. One is android library(app-lib), another(std-pos-app) is android app who depends app-lib.

The Android.mk file in app-lib like bellow:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := app-lib
LOCAL_SRC_FILES := ...
include $(BUILD_SHARED_LIBRARY)

When it's builded, it will produce libapp-lib.so in libs/armeabi fiolder.

std-pos-app want to call the native code in app-lib.so. So the Android.mk file in std-pos-app like bellow:

LOCAL_PATH := $(call my-dir)

#------------------
include $(CLEAR_VARS)
LOCAL_MODULE := app-lib1
LOCAL_SRC_FILES := path-to-libapp-lib/libapp-lib.so
include $(PREBUILT_SHARED_LIBRARY)
#------------------

include $(CLEAR_VARS)
LOCAL_MODULE    := std-pos-app
LOCAL_SRC_FILES := ...
include $(BUILD_SHARED_LIBRARY)

Use PREBUILT_SHARED_LIBRARY to prebuild libapp-lib.so, when std-pos-app is builded, libapp-lib.so and libstd-pos-app.so will appear in libs/armeapi. But when I want to run the std-pos-app, the error occured:

Error generating final archive: Found duplicate file for APK: lib/armeabi/libapp-lib.so

I konw the reason why it happen, because the android project dependency. But how to solve it? Thx.

johnnyfee
  • 323
  • 3
  • 15

1 Answers1

0

I've found an alike thread that describes the same question. And I've solved the problem with the solution in the thread. How to use a library project with both c and java apis on Android

Community
  • 1
  • 1
johnnyfee
  • 323
  • 3
  • 15