Pages

Label

Sabtu, 21 Januari 2017

Add .so file in Android AOSP source code

Hello Guys !!! Hope You are doing well.
Today I am going to discuss How to add .so file in Android AOSP source code external folder.
You can add your prebuilt library in Android AOSP source code and it be a part of your AOSP System Image. I am describing step by step procedure for it.

Step 1 Create a folder ( let say myLibs) inside external folder of AOSP source code.

external folder of AOSP source code refers to external open source libraries.
That means libraries that the Android platform depend upon but that are not primarily developed and maintained by the Android open source project.

examples are webkit for the browser, FreeType for fonts, SqlLite for databases and so on. As more features are added to Android, more of these libraries are included in external.

Step 2 Create a Android.mk file

Create a Android.mk file inside your folder(let say myLibs) and copy your .so file in it.
You can use following content for your android.mk file
# Prebuilt Lib
LOCAL_PATH
:= $(call my-dir)
include $
(CLEAR_VARS)
LOCAL_MODULE
:= libMyabc # your lib name
LOCAL_SRC_FILES
:= libMyabc.so
# your lib .so file name
include $
(BUILD_SHARED_LIBRARY)
Step 3 Add your library in Framework
In final step you have to add your library in Android AOSP framework makefile so that it will recognise and build as a part of System image.
You find Framework Android.mk file on following location
/android_aosp_sourcecode_download_folder/frameworks/base/core/jni/
Open Android.mk file and add your library in following section
LOCAL_SHARED_LIBRARIES := \
You can put your library name in that section example libMyabc \
That's it... now make it (make -j4) and you find your added so file in following folder
/android_aosp_sourcecode_download_folder/out/target/product/generic/obj/lib
with file name like :- libMyabc.so and libMyabc.so.toc
and you also found it in system/lib folder
/android_aosp_sourcecode_download_folder/out/target/product/system/lib

Thanks
Saurabh
Happy Coding...

0 komentar:

Posting Komentar

 
[tutup]