I have faced similar issue but in a different context. I was
assuming that the Android build system would automatically add the
dependency and load the dependent shared libraries. But apparently
that is not the case. You will need to explicitly load the dependent
libraries yourself, which are not system libraries.
hope that helps,
DivKis
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
On Feb 18, 2:33 pm, David Turner <di...@android.com> wrote:
> The Android dynamic linker had a bug that prevented this from working, but
> was fixed in 1.6, I believe.
> If you use the NDK, use "LOCAL_SHARED_LIBRARIES := libB libC" when defining
> the libA module.
> This assumes that libB and libC are also NDK modules that were generated
> with the NDK.
>
> In case libB.so and libC.so are not generated with the NDK, you should do
> the following:
>
> - in the libA module definition, use LOCAL_LDLIBS +=
> /full/path/to/libB.so /full/path/to/libC.so
> this ensures that correct symbol exports are generated in libA.so
>
> - manually copy libB.so and libC.so to $APP_PROJECT/libs/armeabi before
> rebuilding your .apk,
> this ensures that it will be copied to /data/data/<pkgname>/lib at
> installation time by the package manager.
>
> On Sat, Feb 13, 2010 at 8:16 AM, Jin Chiu <live2drea...@gmail.com> wrote:
> > Is it possible for an Android app to load custom shared library that
> > depends on other custom shared libraries associated with this app? To
> > give a concrete example, I would like my app to load shared library
> > "A.so" that is dynamically linked against "B.so" and "C.so". If
> > possible, how would I specify the dependencies in Android build
> > system? Where would I place B.so and C.so in the app directory tree?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-ndk" group.
> > To post to this group, send email to andro...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > android-ndk...@googlegroups.com<android-ndk%2Bunsu...@googlegroups.com>
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
As a simple test setup, I first create a standard shared lib module
called "mylib.so". I then create a separate module called "mylib-
user.so" and set LOCAL_SHARED_LIBRARIES := mylib in its makefile.
Finally, have my java app performs `System.loadLibrary("mylib-user")`.
When I try run the app from Eclipse, I receive the following
exception:
D/dalvikvm( 216): Trying to load lib /data/data/com.example.hellojni/
lib/libmylib-user.so 0x43757368
I/dalvikvm( 216): Unable to dlopen(/data/data/com.example.hellojni/
lib/libmylib-user.so): Cannot load library: link_image[1638]: 29
could not load needed library 'libmylib.so' for 'libmylib-
user.so' (load_library[984]: Library 'libmylib.so' not found)
W/dalvikvm( 216): Exception Ljava/lang/UnsatisfiedLinkError; thrown
during Lcom/example/hellojni/HelloJni;.<clinit>
Even though libmylib.so is in the same directory as libmylib-user.so:
# pwd
/data/data/com.example.hellojni/lib
# ls
libmylib.so
libmylib-user.so
libmylib.so itself implements a native interface that works fine when
used directly, so there's nothing wrong with libmylib.so
On Mar 4, 4:32 pm, David Turner <di...@android.com> wrote:
> It is a known bug of the Android 1.5 dynamic linker that was solved in 1.6.
> If you need to target 1.5, link B statically to A.
>
> > <android-ndk%2Bunsu...@googlegroups.com<android-ndk%252Buns...@googlegroups.com>