0

I'm having troubles working out the dependencies for Jzy3d for my Android Studio project. The stack trace leading to the error is:

at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:454)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:59)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:90)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:328)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:390)
at com.jogamp.common.os.Platform$2.run(Platform.java:249)
at java.security.AccessController.doPrivileged(AccessController.java:45)
at com.jogamp.common.os.Platform.loadGlueGenRTImpl(Platform.java:231)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:183)
at com.jogamp.common.os.Platform.initSingleton(Platform.java:258)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:99)
at javax.media.opengl.GLProfile.isAvailable(GLProfile.java:284)
at org.jzy3d.chart.Settings.<init>(Settings.java:19)
at org.jzy3d.chart.Settings.getInstance(Settings.java:48)
at org.jzy3d.chart.Chart.<init>(Chart.java:60)
at org.jzy3d.chart.Chart.<init>(Chart.java:48)

While crawling through the stack trace, I found the following line in Platform.run:249

GlueJNILibLoader.loadLibrary("gluegen-rt", false, Platform.class.getClassLoader());

So my best guess is that it's trying to load my gluegen-rt.jar, but for some reason is unable to find it.

I've included gluegen-rt in my libs directory

I also attempted to add libgluegen-rt.so to src/main/jniLibs and changed my .grade to include

compile fileTree(dir: 'libs', include: ['*.jar','*.so'])

So basically my question is where is the error? Is it within the inability to load my gluegen-rt.jar, or it's inability to load libgluegen-rt.so? Is the issue caused from me missing a different library?

The code that starts the problem is calling the chart constructor from the Jzy3d libary

Chart chart = new Chart(Quality.Advanced);

Down the line of method calls the following line is executed

GLProfile.isAvailable("GL2")

The lines of code that are used within gluegen-rt are

protected static synchronized boolean loadLibrary(String var0, boolean var1, ClassLoader var2) {
    return loaderAction != null?loaderAction.loadLibrary(var0, var1, var2):false;
}
Ryan Chrome
  • 1
  • 1
  • 4

1 Answers1

0

Follow the instructions in Android Studio: Add jar as a library?

You are missing these steps:

  1. Put the Jzy3d jar into the libs folder.
  2. Right click it and hit 'Add as library'
  3. Add the following line in dependencies:

    compile 'org.jogamp.gluegen:gluegen-rt-android:2.1.3'
    

You can remove *.so from :

compile fileTree(dir: 'libs', include: ['*.jar','*.so'])
Rajanya Dhar
  • 166
  • 6
  • I don't see an 'Add as library' option when left clicking. Also, when adding the line mentioned in your third point, I get a DuplicateFileException. I already have a line compile files('libs/gluegen-rt.jar') – Ryan Chrome Jun 04 '17 at 21:34
  • In that case add: compile files('libs/.jar') ..[please replace with exact jar file's name] Please ignore the third line if you have already included gluegen-rt.jar. – Rajanya Dhar Jun 05 '17 at 01:36