Question

i've build my own androidrom from source and modified a few things. But now i wan't to add an prebuilt .apk to the project, read that i should make an folder in /packages/apps/ and add the .apk and an Android.mk to it with following code

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := <folder name>
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)

and the added the module to the in my case /device/sony/honami/full_honami.mk when i now run brunch i get the error after some time that no rule for target * so i tried some changes but nothing works for me and i can't find something where there write something other than this ...

so i added the .apk to the /vendor/cm/prebuilts folder and in the *.mk where i found the other .apks where copyed to the device i added my app and run brunch without an error.

But when i now start the app, which is on the device, it crash. Via Logcat i found out that this apk have some .so files in it and that it can't find them. This is because i only copied the app not the .so files in the lib directory. But i can't find some solution for my problem. Should i now extract the .so file and copy it like the .apk to the path the app looks? or is there a better solution for doing this?

Cheers Moritz

Was it helpful?

Solution

AOSP build system handles the shared libraries differently from Eclipse-ADT.

You will need to extract that .so from your apk and create an Android.mk to it.

To extract the .so, just unzip the apk and get it from libs folder.

Here is an example for the Android.mk to libfoo.so shared library:

LOCAL_PATH:= $(call my-dir)

# prebuilt shared library
include $(CLEAR_VARS)
LOCAL_MODULE := libfoo
LOCAL_SRC_FILES := libfoo.so
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib
LOCAL_MODULE_TAGS := optional

include $(BUILD_PREBUILT)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top