location of my native library?

2,584 views
Skip to first unread message

hamlatzis

unread,
Mar 17, 2012, 6:59:05 AM3/17/12
to andro...@googlegroups.com
Finally I've managed to compile/build and create my apk package for my game. I've tried to debug it on the emulator but it crashes a lot sooner than it reaches my main function.
It seams that my library (libRoyalReels.so) cannot be found where it is supposed to be. I've opened the .apk file and found it under the folder /lib/armeabi, then why it cannot be found?

I'm using Windows XP (32bit) with eclipse IDE and the ADT plugin.

Any ideas?

03-17 12:39:19.266: D/AndroidRuntime(343): Shutting down VM
03-17 12:39:19.266: W/dalvikvm(343): threadid=1: thread exiting with uncaught exception (group=0x40015560)
03-17 12:39:19.476: E/AndroidRuntime(343): FATAL EXCEPTION: main
03-17 12:39:19.476: E/AndroidRuntime(343): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.iosif.hamlatzis/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/data/com.iosif.hamlatzis/lib/libRoyalReels.so
03-17 12:39:19.476: E/AndroidRuntime(343): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-17 12:39:19.476: E/AndroidRuntime(343): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-17 12:39:19.476: E/AndroidRuntime(343): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-17 12:39:19.476: E/AndroidRuntime(343): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-17 12:39:19.476: E/AndroidRuntime(343): at android.os.Handler.dispatchMessage(Handler.java:99)
03-17 12:39:19.476: E/AndroidRuntime(343): at android.os.Looper.loop(Looper.java:123)
03-17 12:39:19.476: E/AndroidRuntime(343): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-17 12:39:19.476: E/AndroidRuntime(343): at java.lang.reflect.Method.invokeNative(Native Method)
03-17 12:39:19.476: E/AndroidRuntime(343): at java.lang.reflect.Method.invoke(Method.java:507)
03-17 12:39:19.476: E/AndroidRuntime(343): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-17 12:39:19.476: E/AndroidRuntime(343): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-17 12:39:19.476: E/AndroidRuntime(343): at dalvik.system.NativeStart.main(Native Method)
03-17 12:39:19.476: E/AndroidRuntime(343): Caused by: java.lang.IllegalArgumentException: Unable to load native library: /data/data/com.iosif.hamlatzis/lib/libRoyalReels.so
03-17 12:39:19.476: E/AndroidRuntime(343): at android.app.NativeActivity.onCreate(NativeActivity.java:199)
03-17 12:39:19.476: E/AndroidRuntime(343): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-17 12:39:19.476: E/AndroidRuntime(343): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-17 12:39:19.476: E/AndroidRuntime(343): ... 11 more

Baodong Chen

unread,
Mar 17, 2012, 11:09:24 PM3/17/12
to andro...@googlegroups.com
On Sat, Mar 17, 2012 at 6:59 PM, hamlatzis <i.ham...@gmail.com> wrote:
> Finally I've managed to compile/build and create my apk package for my game.
> I've tried to debug it on the emulator but it crashes a lot sooner than it
> reaches my main function.
> It seams that my library (libRoyalReels.so) cannot be found where it is
> supposed to be. I've opened the .apk file and found it under the folder
> /lib/armeabi, then why it cannot be found?
you may use adb shell ls -l /data/data/com.iosif.hamlatzis/lib/ to see if
your .so is unpacked correctly,if not, try reinstall ..
i'am still cruious why sometimes installation goes wrong
> --
> You received this message because you are subscribed to the Google Groups
> "android-ndk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/android-ndk/-/4cQDQBcYSxUJ.
> 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.

Iosif Hamlatzis

unread,
Mar 18, 2012, 4:11:09 AM3/18/12
to andro...@googlegroups.com
I've tried your command line : adb shell ls -l /data/data/com.iosif.hamlatzis/lib/

to check what is or isn't installed and I can see that the library is at the correct place. I don't understand then why I get the error message: 

java.lang.IllegalArgumentException: Unable to load native library:
 /data/data/com.iosif.hamlatzis/lib/libRoyalReels.so


C:\Documents and Settings\Iosif\.android\avd>adb shell ls -l /data/data/com.iosif.hamlatzis/lib/
-rwxr-xr-x system   system     125208 2012-01-25 15:39 gdbserver
-rwxr-xr-x system   system     710612 2012-03-17 12:37 libSDL_ttf.so
-rwxr-xr-x system   system     261940 2012-03-17 12:37 libSDL_mixer.so
-rwxr-xr-x system   system     351816 2012-03-17 12:37 libSDL_image.so
-rwxr-xr-x system   system    1123540 2012-03-17 12:37 libSDL.so
-rwxr-xr-x system   system    3058012 2012-03-17 12:37 libRoyalReels.so
-rwxr-xr-x system   system     377532 2012-03-17 12:37 libmikmod.so

Fredrik Ehnbom

unread,
Mar 18, 2012, 5:01:51 AM3/18/12
to andro...@googlegroups.com
Maybe its dependencies aren't resolved. You need to call System.loadlibrary() in reversed order on your shared libs, or link statically.


/f

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.

Tim Ding

unread,
Mar 17, 2012, 7:56:41 AM3/17/12
to andro...@googlegroups.com
This is because the libRoyalReel.so can't be loaded, do it depend on some other library files?

On Sat, Mar 17, 2012 at 6:59 PM, hamlatzis <i.ham...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/4cQDQBcYSxUJ.

i.ham...@gmail.com

unread,
Mar 18, 2012, 3:04:58 PM3/18/12
to andro...@googlegroups.com
Yes in my Android.mk file I have declared that it uses the shared libraries libSDL.so, libSDL_image.so, libSDL_image and libSDL_ttf. I've checked through the adt shell command that all .so files, are in the correct folder and yes they are.

My game is pure native c/c++ and haven't written any java line of code. I've used the eclipse IDE to create the project, so I cannot include to manually load the SDL libraries before my game's shared library.

As I know nothing about java I try to have as little as possible with java. I was given the impression that through the use of the NDK one could go directly to c/c++, but maybe I misunderstood.



-- Sent from my HP TouchPad

Reply all
Reply to author
Forward
0 new messages