Missing nativeInit when compiling multimple files

Posted by RankoR on Stack Overflow See other posts from Stack Overflow or by RankoR
Published on 2012-09-07T07:07:36Z Indexed on 2012/09/10 3:38 UTC
Read the original article Hit count: 258

Filed under:
|

Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE    := pacman
LOCAL_SRC_FILES := main.cpp \
        Pacman.cpp
LOCAL_CFLAGS := -DANDROID_NDK \
                -DDISABLE_IMPORTGL
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog

include $(BUILD_SHARED_LIBRARY)

In main.cpp:

void Java_com_wiagames_pacman_PacmanRenderer_nativeInit(JNIEnv* env) {
...
}

The package is com.wiagames.pacman; The Java class, containing the nativeInit method, is PacmanRenderer in the com.wiagames.pacman package. It works fine before I added pacman.cpp, but after adding it I have:

E/AndroidRuntime( 2238): FATAL EXCEPTION: GLThread 1104
E/AndroidRuntime( 2238): java.lang.UnsatisfiedLinkError: Native method not found: com.wiagames.pacman.PacmanRenderer.nativeInit:()V
E/AndroidRuntime( 2238):    at com.wiagames.pacman.PacmanRenderer.nativeInit(Native Method)
E/AndroidRuntime( 2238):    at com.wiagames.pacman.PacmanRenderer.onSurfaceCreated(MainActivity.java:120)
E/AndroidRuntime( 2238):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1494)
E/AndroidRuntime( 2238):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
W/ActivityManager(  306):   Force finishing activity com.wiagames.pacman/.MainActivity

main.c: http://pastebin.com/GPexqwcv

MainActivity.java: http://pastebin.com/yWfWpyNb

© Stack Overflow or respective owner

Related posts about android

Related posts about android-ndk