Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running APK: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_javajpeg" referenced by [..]/lib&arm64/libsubstrate.so" #377

Open
taranion opened this issue Oct 20, 2021 · 4 comments

Comments

@taranion
Copy link

I am not sure where to report this - here or at substrate ...

Client Version: 1.0.7
Android 11
Tested with GraalVM 21.1 and 21.3 (Java 11 variant)
Built on: Fedora 34 or GitHub actions on ubuntu-18.04

I can create native images of my application for Android or Linux and run it just fine on Linux.
On Android (11) I get an UnsatisfiedLinkError for JNI_Onload_javajpeg in libsubstrate

10-20 13:32:04.658 24861 24861 D AndroidRuntime: Shutting down VM
10-20 13:32:04.660 24861 24861 E AndroidRuntime: FATAL EXCEPTION: main
10-20 13:32:04.660 24861 24861 E AndroidRuntime: Process: de.myapp.cfxmobile, PID: 24861
10-20 13:32:04.660 24861 24861 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_javajpeg" referenced by "/data/app/~~2xTVqTzqtI5R4y6mDrHE0A==/de.myapp.cfxmobile-ZmjpH0G4TxhquxRapj2p0Q==/lib/arm64/libsubstrate.so"...
10-20 13:32:04.660 24861 24861 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
10-20 13:32:04.660 24861 24861 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
10-20 13:32:04.660 24861 24861 E AndroidRuntime: 	at java.lang.System.loadLibrary(System.java:1664)
10-20 13:32:04.660 24861 24861 E AndroidRuntime: 	at com.gluonhq.helloandroid.MainActivity.surfaceCreated(MainActivity.java:104)
10-20 13:32:04.660 24861 24861 E AndroidRuntime: 	at android.view.SurfaceView.updateSurface(SurfaceView.java:1153)
10-20 13:32:04.660 24861 24861 E AndroidRuntime: 	at android.view.SurfaceView.lambda$new$0$SurfaceView(SurfaceView.java:173)

Probably related, probably not: On my Fedora 34 machine, the regular Java runtime fails to display JPEG files since an Fedora update. To eliminate my local machine I tested using Github actions, but got the same problem with the resulting APK.

@mipastgt
Copy link

Did you try with https://github.com/gluonhq/graal/releases/tag/gluon-21.2.0-dev-20210621_1207 Note: This is a Gluon build and not the standard GraalVM build.

@taranion
Copy link
Author

taranion commented Oct 20, 2021

No, I hadn't. I just did and the result (with an APK built with that GraalVM build) is the same.

10-20 15:05:31.291  9681  9681 D AndroidRuntime: Shutting down VM
10-20 15:05:31.292  9681  9681 E AndroidRuntime: FATAL EXCEPTION: main
10-20 15:05:31.292  9681  9681 E AndroidRuntime: Process: de.myapp.cfxmobile, PID: 9681
10-20 15:05:31.292  9681  9681 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_javajpeg" referenced by "/data/app/~~91FjfM9W8SW5LoKfJnO3-A==/de.myapp.cfxmobile-d2pDXV9obJdeNxDWIwRmAw==/lib/arm64/libsubstrate.so"...
10-20 15:05:31.292  9681  9681 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
10-20 15:05:31.292  9681  9681 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
10-20 15:05:31.292  9681  9681 E AndroidRuntime: 	at java.lang.System.loadLibrary(System.java:1664)
10-20 15:05:31.292  9681  9681 E AndroidRuntime: 	at com.gluonhq.helloandroid.MainActivity.surfaceCreated(MainActivity.java:104)
10-20 15:05:31.292  9681  9681 E AndroidRuntime: 	at android.view.SurfaceView.updateSurface(SurfaceView.java:1153)

The native image produced for my Linux machine still runs without problems using this build.

@makingthematrix
Copy link

@taranion
This is a Gluon Substrate issue. I was able to fix it locally by adding dummy methods to the Android launcher and compiling my own plugin, but it might not be the best solution for more complex applications. Please take a look at gluonhq/substrate#1000 (and maybe leave a comment there that you're also interested in solving this problem).

@H-Lo
Copy link

H-Lo commented Jun 3, 2023

Oh! Yesterday I filed a bug about this: oracle/graal#6729
@makingthematrix Adding dummy methods didin't help because my graphics were gone and all I got is a black blank screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants