I am trying to make an android project using native code to call an OpenGl function.
I follow this guide to get this land project: http://www.learnopengles.com/calling-opengl-from-android-using-the-ndk/
According to this guide, I have to “right-click on the project in the Package Explorer, select“ Android Tools ”from the drop-down menu, and then select“ Add root support ... ”. However, this option does not appear in my version of eclipse (last version of osx from the Android site bundled with sdk).
To get around this, I manually converted the project to a C / C ++ project using: file → new → other → Convert to C / C ++ Project (adds support for C / C ++).
Then I added the PATH variable to the environment variables found in the project properties -> C / C ++ build -> Environment. And I added the path to ndk to this variable.
Next, I made the necessary makefiles and generated the jni file. The project compiles and generates a .so file in the libs directory. However, when I try to run the project on the device, I get the following runtime error:
Exception java / lang / UnsatisfiedLinkError; upon initialization nl / blaat / project_name / JNIWrapper; java.lang.UnsatisfiedLinkError: Failed to load GLCore from the dalvik.system.PathClassLoader [dexPath = / data / app / nl.blaat.project_name bootloader.
When I search on the Internet, the usual answer to the problem is that the native code did not compile, but in my case it does. The sample projects provided by the NDK give the same problem.
EDIT: Additional information that may help in identifying the problem.
- The problem occurs both in the OS and in the windows.
- The problem arises on my s2 and s5 samsung galaxies, so it is probably not device specific.
- The problem also occurs on samples shipped with the SDK.
Android.mk
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := OpenGLCore LOCAL_CFLAGS := -Wall -Wextra LOCAL_SRC_FILES := OpenGLCore.c jni.c LOCAL_LDLIBS := -lGLESv2 include $(BUILD_SHARED_LIBRARY)
Application.mk
APP_PLATFORM := android-10 APP_ABI := all