I need to add SqlCipher to an existing Android app that uses an Android.mk file. It doesn’t use Eclipse or Android Studio.
The app is written entirely in Java (no JNI code). I was able to build and us SqlCipher in Eclipse but I need to make it build using an Android.mk file before I can submit my changes.
I copied the .jar and .so files to these sub diretories.
libs/google-play-services.jar
libs/sqlcipher.jar
libs/armeabi/libdatabase_sqlcipher.so
libs/armeabi/libsqlcipher_android.so
libs/armeabi/libstlport_shared.so
libs/armeabi-v7a/libdatabase_sqlcipher.so
libs/armeabi-v7a/libsqlcipher_android.so
libs/armeabi-v7a/libstlport_shared.so
libs/x86/libdatabase_sqlcipher.so
libs/x86/libsqlcipher_android.so
libs/x86/libstlport_shared.so
Below is how the Android.mk file looks currently.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := MyApplication
LOCAL_STATIC_JAVA_LIBRARIES := \
sqlcipher \
android-support-v4 \
google-services
LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages com.google.android.gms
LOCAL_PROGUARD_FLAG_FILES := proguard-project.txt
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/google_play_res/ $(LOCAL_PATH)/res
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := sqlcipher:libs/sqlcipher.jar \
google-services:libs/google-play-services.jar
include $(BUILD_MULTI_PREBUILT)
I tried adding the below code to the Andorid.mk file but the .so files are not being added to the apk file.
include $(CLEAR_VARS)
LOCAL_MODULE := libdatabase_sqlcipher
LOCAL_SRC_FILES := $(LOCAL_PATH)/libs/armeabi-v7a/libdatabase_sqlcipher.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libsqlcipher_android
LOCAL_SRC_FILES := $(LOCAL_PATH)/libs/armeabi-v7a/libsqlcipher_android.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libstlport_shared
LOCAL_SRC_FILES := $(LOCAL_PATH)/libs/armeabi-v7a/libstlport_shared.so
include $(PREBUILT_SHARED_LIBRARY)
Thank you.