为什么我收到此错误?
I/System.out( 1852): libSDL: accelerometer start required: false
W/dalvikvm( 1852): No implementation found for native Lcom/starlon/froyvisuals/DemoRenderer;.nativeInit (Ljava/lang/String;Ljava/lang/String;I)V
W/dalvikvm( 1852): threadid=10: thread exiting with uncaught exception (group=0x40176560)
E/AndroidRuntime( 1852): FATAL EXCEPTION: GLThread
E/AndroidRuntime( 1852): java.lang.UnsatisfiedLinkError: nativeInit
E/AndroidRuntime( 1852): at com.starlon.froyvisuals.DemoRenderer.nativeInit(Native Method)
E/AndroidRuntime( 1852): at com.starlon.froyvisuals.DemoRenderer.onDrawFrame(Video.java:363)
E/AndroidRuntime( 1852): at com.starlon.froyvisuals.GLSurfaceView_SDL$GLThread.run(GLSurfaceView_SDL.java:996)
W/ActivityManager( 112): Force finishing activity com.starlon.froyvisuals/.MainActivity
I/System.out( 1852): libSDL: stopping accelerometer
V/SDL ( 1852): GLSurfaceView_SDL::onPause()
答案 0 :(得分:1)
如果Java虚拟机无法找到声明为native的方法的适当本机语言定义,则抛出
似乎与本机库libSDL不兼容。它可以是较旧版本(或)较新版本。
答案 1 :(得分:0)
您需要自己定义void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv * env, jclass cls, jobject obj)
(这是您的切入点)。如果您正在使用C ++,请注意在extern块中定义其签名,如下所示:
extern "C" {
JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj);
};
主要功能的骨架可以在https://github.com/spurious/SDL-mirror/blob/master/src/main/android/SDL_android_main.c
中找到