This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Installing Android application (.apk) along with pre-built library

Other Parts Discussed in Thread: 4460

Hi,

I am working on OMAP 4460 Android ICS,

I am installing a custom application (.apk)  on Android, While installing I am copying a shared library to following location.

/data/data/iw.vscan.capture/lib/

I am able to run the application right after installation, it is running fine.After reboot, Library is not there in the above mentioned folder.

This is my jni/Android.mk

----------------------------------

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

TARGET_PLATFORM := android-8
LOCAL_MODULE    := libVscanGE
LOCAL_SRC_FILES := camera.c
LOCAL_LDLIBS    := -llog

include $(BUILD_SHARED_LIBRARY)

My jni/Application.mk

----------------------------

APP_ABI := armeabi
APP_PLATFORM := android-8
APP_MODULES  := libVscanGE

I have flashed the Android Binaries to SD card through fastboot.

With Regards,

Lahir

  • Hi Lahir,

    Did you try the following sequence of commands after pushing the shared library using adb push command?

    adb shell sync

    adb shell stop

    adb shell start

    Do you see the same result as reboot? Does the pushed shared library gets deleted?

    Alternately, is it possible for you rebuilt the system.img with the new shared library and flash that again on the device and then check it.

    Thanks & Best Regards,

    Venkat

  • I read when building a .apk that it is needed to add the library to the root directory of the project and add this library in the project properties, in this way library will be added inside .apk. I didn't try it at that time but I remember to read about it, by reading the properties for a project it has a section where to add the libraries but it become a little tricky when the library source code is added and it is defined in the project too, Eclipse was not able to compile it but adding the project to Android FS ($MYDROID) it was able to compile the project and .apk used the libraries, at the end I copied the library manually to /system/lib folder but it must be possible to add it in the .apk for what i read.

    Another important thing to do is to sign the .apk, this open some features when using it in a device. You can sign the .apk by doing right-click in the projects tree and selecting sign, the other option is to use command line.

    http://developer.android.com/tools/publishing/app-signing.html

  • Hi Lahir,

    It is not recommended to place libraries in your data folder, if you write libraries there those libs would be likely to be overridden, it is better to install them in the system/lib directory. You can use adb commands like  "abd push" to install it.