Wednesday, June 29, 2016

Android Development - using native .so libraries


Class using native libraries (.so) does not work, and LogCat shows warnings like this:

android eclipse Rejecting re-init on previously-failed class java.lang.Class< ***SOME CLASS**>

Problem description:

Basically, if you cannot get the native library to load, and you have included both the .jar file (in libs folder in Eclipse) and .so file (in approprate armeabi / armeabi-v7a folder), you should first check the full stack trace for the error.
In LogCat, let the program run after the exception. It should point out something like "Cannot load class XYZ", which is probably the root cause of the issue.

In case you cannot load class com.sun.platform or something similar, you should include jni.jar inside your libs folder, and delete all incompatible .so files inside of that .jar (for example, for linux, freebsd and other OSes). Also, you should include appropriate in your armeabi folder.

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...