I am trying to run an SDL project on an Android tablet, using the Android ndk. Finally I succeeded to compile and install a simple SDL file, without errors or warnings. The app icon appeared, I started it, and then: black screen. I suppose that my SDL file is missing something, but I don’t know what. So my question is: how must the SDL code look, that will display e.g. a black square on a red background, with one touch point? No OpenGL, no animations, no sound, only SDL_Renderer used. I am using the newest software: SDL2, ARM tablet running Android 4.0. Until now, only the “Hello World” example worked as expected.
It occurred to me that my SDL source code was not compiled at all, but after a fresh install of the SDL directory this problem appeared to be solved. Now the next hurdle is a linking problem at run time. The ‘adb logcat’ output always reports the following error:
Code:
E/AndroidRuntime( 1213): FATAL EXCEPTION: SDLThread
E/AndroidRuntime( 1213): java.lang.UnsatisfiedLinkError: nativeInit
E/AndroidRuntime( 1213): at org.libsdl.app.SDLActivity.nativeInit(Native Method)
E/AndroidRuntime( 1213): at org.libsdl.app.SDLMain.run(SDLActivity.java:408)
E/AndroidRuntime( 1213): at java.lang.Thread.run(Thread.java:856)
it looks like you don’t load the shared object - are you using the
activity class that comes with sdl?Am 23.08.2012 14:26, schrieb wboe:
It occurred to me that my SDL source code was not compiled at all, but
after a fresh install of the SDL directory this problem appeared to be
solved. Now the next hurdle is a linking problem at run time. The ‘adb
logcat’ output always reports the following error:
Code:
E/AndroidRuntime( 1213): FATAL EXCEPTION: SDLThread
E/AndroidRuntime( 1213): java.lang.UnsatisfiedLinkError: nativeInit
E/AndroidRuntime( 1213): at
org.libsdl.app.SDLActivity.nativeInit(Native Method)
E/AndroidRuntime( 1213): at
org.libsdl.app.SDLMain.run(SDLActivity.java:408)
E/AndroidRuntime( 1213): at java.lang.Thread.run(Thread.java:856)
Can you post the full log of your app? You should be seeing a message about
loading libSDL2.so, if I recall correctly that’s where nativeInit is.–
Gabriel.
This is an addendum to my last post.
The essential error message from the logcat output is
Code:
W/dalvikvm( 1441): No implementation found for native Lorg/libsdl/app/SDLActivity;.nativeInit ()V
This must be the problem. Indeed nowhere on my hard disk there is something like nativeInit.class. Which script or program should be responsible for this?
**
This is an addendum to my last post.
The essential error message from the logcat output is
Code:
W/dalvikvm( 1441): No implementation found for native
Lorg/libsdl/app/SDLActivity;.nativeInit ()V
This must be the problem. Indeed nowhere on my hard disk there is
something like nativeInit.class. Which script or program should be
responsible for this?
If you look at SDLActivity.java, you’ll see on line 149:
// C functions we call
public static native void nativeInit();
public static native void nativeQuit();
public static native void nativePause();
public static native void nativeResume();
…
Those functions on the C side of the code are
called Java_org_libsdl_app_SDLActivity_ so nativeInit would
be Java_org_libsdl_app_SDLActivity_nativeInit which is located in
src/main/android/SDL_android_main.cpp
// Start up the SDL app
extern “C” void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env,
jclass cls, jobject obj)
I’ll start by making sure you have libSDL2.so and libmain.so in your
<android_project>/libs/armeabi after you go through the build process.–
Gabriel.