A problem of making the "HelloJni" app be a system application...

3,541 views
Skip to first unread message

tgh

unread,
Sep 4, 2009, 8:26:43 AM9/4/09
to android-ndk
I have tried to make the NDK-example application "HelloJni" be a
system application by the following steps:

1. generate the HelloJni.apk by Eclipse.
2. put HelloJni.apk into the directory /mydroid/out/target/product/
generic/system/app
3. cd /mydroid/; make snod
4. I get the "system.img" from /mydroid/out/target/product/generic/
5. Run the android emulator with the "system.img"

From File Explorer in DDMS, I can see the file/directories

/system/app/HelloJni.apk,
/data/data/com.example.hellojni,
and its sub-directory:
/data/data/com.example.hellojni/lib

However, the .so file "libhello-jni.so" didn't exist in "/data/data/
com.example.hellojni/lib/" or "/system/lib/"!!
And then, I get the "java.lang.UnsatisfiedLinkError" exception...

"libhello-jni.so" should be automatically copied to "/data/data/
com.example.hellojni/lib/" by android OS, isn't it?

(If I use "adb install HelloJni.apk" or put "libhello-jni.so" into "/
data/data/com.example.hellojni/lib/" mamually, the application runs
smoothly! )

My problem is that why the .so file "libhello-jni.so" didn't be copied
into "/data/data/com.example.hellojni/lib" automatically while
HelloJni.apk as a system application??

Does anyone know why?

Thanks!!

fadden

unread,
Sep 4, 2009, 1:15:08 PM9/4/09
to android-ndk
On Sep 4, 5:26 am, tgh <tgh1...@gmail.com> wrote:
> My problem is that why the .so file "libhello-jni.so" didn't be copied
> into "/data/data/com.example.hellojni/lib" automatically while
> HelloJni.apk as a system application??

My understanding is that, for a system APK, the shared library is also
expected to live in /system. Since /system is mounted read-only, this
has to be done as part of creating the system image.

When you use "adb install", the app lives in /data, so the shared
library lives there as well and is unpacked by the installer.

Mohammad Saleh Dehghanpour

unread,
Oct 3, 2018, 1:34:34 PM10/3/18
to android-ndk
Hello
I put lib folder along my 3rd party apks in correct path but ther were not copied when building SDK to /system/lib or /system/lib64
Although for other apps the libraries i.e. .so files are copied automatically

So I should manually copy them to have working apps after burning image!

Do you know the problem? 

Thanks a lot 

در جمعه 4 سپتامبر 2009، ساعت 21:45:08 (UTC+4:30)، fadden نوشته:
Reply all
Reply to author
Forward
0 new messages