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 when running APK generated by GraalVM native-image, java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_awt" #349

Open
ctoabidmaqbool opened this issue Jun 21, 2021 · 10 comments

Comments

@ctoabidmaqbool
Copy link

I am working on a project which was using old javafxmobile-plugin & gradle. Now try to convert it to gluonfx-maven-plugin. All steps are fine until e.g. mvn clean -Pandroid gluonfx:build gluonfx:package gluonfx:install.

But when try to run APK on Emulator / Android using mvn -Pandroid gluonfx:nativerun this error is shown logs are below, I am unable to detect why this error is happening there. Any idea to fix it?

[Mon Jun 21 10:06:55 PKT 2021][INFO] ==================== RUN TASK ====================
[Mon Jun 21 10:06:55 PKT 2021][FINE] PB Command for clearLog: /mnt/d/AndroidSDKLinux/platform-tools/adb logcat -c
[Mon Jun 21 10:06:55 PKT 2021][FINE] Start process clearLog...
[Mon Jun 21 10:06:55 PKT 2021][FINE] PB Command for run: /mnt/d/AndroidSDKLinux/platform-tools/adb shell monkey -p com.maqboolsolutions.myproject 1
[Mon Jun 21 10:06:55 PKT 2021][FINE] Start process run...
[Mon Jun 21 10:06:55 PKT 2021][FINE] Result for clearLog: 0
[Mon Jun 21 10:06:55 PKT 2021][FINE] PB Command for log: /mnt/d/AndroidSDKLinux/platform-tools/adb logcat -v brief -v color GraalCompiled:V GraalActivity:V GraalGluon:V GluonAttach:V AndroidRuntime:E ActivityManager:W *:S
[Mon Jun 21 10:06:55 PKT 2021][FINE] Start process log...
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] --------- beginning of main
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] --------- beginning of system
[Mon Jun 21 10:06:56 PKT 2021][FINE] [SUB] Events injected: 1
[Mon Jun 21 10:06:56 PKT 2021][FINE] [SUB] ## Network stats: elapsed time=20ms (0ms mobile, 0ms wifi, 20ms not connected)
[Mon Jun 21 10:06:56 PKT 2021][FINE] Result for run: 0
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity( 7186): onCreate start, using Android Logging v1�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity( 7186): onCreate done�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity( 7186): onStart�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity( 7186): onStart done�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity( 7186): onResume�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity( 7186): onResume done�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity( 7186): surfaceCreated for com.gluonhq.helloandroid.MainActivity@43e9a14�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity( 7186): loading substrate library�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): in writeCrashedAppName, pkgName :com.maqboolsolutions.myproject�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] --------- beginning of crash
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): FATAL EXCEPTION: main�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): Process: com.maqboolsolutions.myproject, PID: 7186�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): java.lang.UnsatisfiedLinkError: undefined symbol: _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9underflowEv�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at java.lang.Runtime.loadLibrary0(Runtime.java:999)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at java.lang.System.loadLibrary(System.java:1562)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at com.gluonhq.helloandroid.MainActivity.surfaceCreated(MainActivity.java:104)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.view.SurfaceView.updateWindow(SurfaceView.java:618)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:161)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2205)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6338)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.view.Choreographer.doCallbacks(Choreographer.java:686)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.view.Choreographer.doFrame(Choreographer.java:621)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.os.Handler.handleCallback(Handler.java:751)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.os.Handler.dispatchMessage(Handler.java:95)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.os.Looper.loop(Looper.java:154)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at android.app.ActivityThread.main(ActivityThread.java:6138)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at java.lang.reflect.Method.invoke(Native Method)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime( 7186): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)�[0m
[Mon Jun 21 10:06:56 PKT 2021][INFO] [SUB] �[38;5;166mW/ActivityManager( 2451): Force removing ActivityRecord{b211639 u0 com.maqboolsolutions.myproject/com.gluonhq.helloandroid.MainActivity t61}: app died, no saved state�[0m
[Mon Jun 21 10:07:03 PKT 2021][FINE] Result for log: 130

Output of java -version:

java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment GraalVM 21.1.0-dev (build 11.0.11+5-jvmci-21.1-b03)
OpenJDK 64-Bit Server VM GraalVM 21.1.0-dev (build 11.0.11+5-jvmci-21.1-b03, mixed mode, sharing)

Output of mvn -Pandroid dependency:tree:

--- maven-dependency-plugin:2.8:tree (default-cli) @ myproject ---
com.maqboolsolutions:myproject:jar:1.0.0-SNAPSHOT
+- org.openjfx:javafx-controls:jar:16:compile
|  +- org.openjfx:javafx-controls:jar:linux:16:compile
|  \- org.openjfx:javafx-graphics:jar:16:compile
|     +- org.openjfx:javafx-graphics:jar:linux:16:compile
|     \- org.openjfx:javafx-base:jar:16:compile
|        \- org.openjfx:javafx-base:jar:linux:16:compile
+- com.gluonhq.attach:device:jar:4.0.11:compile
+- com.gluonhq.attach:display:jar:4.0.11:compile
+- com.gluonhq.attach:lifecycle:jar:4.0.11:compile
+- com.gluonhq.attach:orientation:jar:4.0.11:compile
+- com.gluonhq.attach:share:jar:4.0.11:compile
+- com.gluonhq.attach:storage:jar:4.0.11:compile
+- com.gluonhq.attach:keyboard:jar:4.0.11:compile
+- com.gluonhq.attach:util:jar:4.0.11:compile
+- com.jfoenix:jfoenix:jar:9.0.10:compile
+- com.itextpdf:itextpdf:jar:5.5.13.2:compile
+- com.zaxxer:HikariCP-java6:jar:2.3.13:compile
|  \- org.slf4j:slf4j-api:jar:1.7.10:compile
+- com.codahale.metrics:metrics-core:jar:3.0.0:compile
+- org.hsqldb:hsqldb:jar:2.5.1:compile
+- org.slf4j:slf4j-log4j12:jar:1.7.30:compile
|  \- log4j:log4j:jar:1.2.17:compile
\- mysql:mysql-connector-java:jar:5.1.42:compile

&

<javafx.version>16</javafx.version>
<attach.version>4.0.11</attach.version>
<javafx.maven.plugin.version>0.0.6</javafx.maven.plugin.version>
<gluonfx.maven.plugin.version>1.0.1</gluonfx.maven.plugin.version>

Let me know, if any more info is needed, please it's commercially project I can't share whole code.. thanks

@ctoabidmaqbool
Copy link
Author

Umm, sorry previous errors was comming when using latest emulator Nox App player x64 bit.
Using physically device e.g. Android 11 this error is comming:

[Mon Jun 21 15:36:08 PKT 2021][INFO] ==================== RUN TASK ====================
[Mon Jun 21 15:36:08 PKT 2021][FINE] PB Command for clearLog: /mnt/d/AndroidSDKLinux/platform-tools/adb logcat -c
[Mon Jun 21 15:36:08 PKT 2021][FINE] Start process clearLog...
[Mon Jun 21 15:36:08 PKT 2021][FINE] PB Command for run: /mnt/d/AndroidSDKLinux/platform-tools/adb shell monkey -p com.maqboolsolutions.myproject 1
[Mon Jun 21 15:36:08 PKT 2021][FINE] Start process run...
[Mon Jun 21 15:36:08 PKT 2021][FINE] [SUB]   bash arg: -p
[Mon Jun 21 15:36:08 PKT 2021][FINE] [SUB]   bash arg: com.maqboolsolutions.myproject
[Mon Jun 21 15:36:08 PKT 2021][FINE] [SUB]   bash arg: 1
[Mon Jun 21 15:36:09 PKT 2021][FINE] Result for clearLog: 0
[Mon Jun 21 15:36:09 PKT 2021][FINE] PB Command for log: /mnt/d/AndroidSDKLinux/platform-tools/adb logcat -v brief -v color GraalCompiled:V GraalActivity:V GraalGluon:V GluonAttach:V AndroidRuntime:E ActivityManager:W *:S
[Mon Jun 21 15:36:09 PKT 2021][FINE] Start process log...
[Mon Jun 21 15:36:09 PKT 2021][INFO] [SUB] --------- beginning of main
[Mon Jun 21 15:36:09 PKT 2021][FINE] [SUB] args: [-p, com.maqboolsolutions.myproject, 1]
[Mon Jun 21 15:36:09 PKT 2021][FINE] [SUB]  arg: "-p"
[Mon Jun 21 15:36:09 PKT 2021][FINE] [SUB]  arg: "com.maqboolsolutions.myproject"
[Mon Jun 21 15:36:09 PKT 2021][FINE] [SUB]  arg: "1"
[Mon Jun 21 15:36:09 PKT 2021][FINE] [SUB] data="com.maqboolsolutions.myproject"
[Mon Jun 21 15:36:10 PKT 2021][FINE] [SUB] Events injected: 1
[Mon Jun 21 15:36:10 PKT 2021][FINE] [SUB] ## Network stats: elapsed time=73ms (0ms mobile, 0ms wifi, 73ms not connected)
[Mon Jun 21 15:36:10 PKT 2021][FINE] Result for run: 0
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity(32022): onCreate start, using Android Logging v1�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity(32022): onCreate done�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity(32022): onStart�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity(32022): onStart done�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity(32022): onResume�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity(32022): onResume done�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity(32022): surfaceCreated for com.gluonhq.helloandroid.MainActivity@f6d546d�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;231mV/GraalActivity(32022): loading substrate library�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] --------- beginning of crash
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): FATAL EXCEPTION: main�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): Process: com.maqboolsolutions.myproject, PID: 32022�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_awt" referenced by "/data/app/~~39LXkPgmTrISwC1MPz0-aw==/com.maqboolsolutions.myproject-h6E02fzSpPHVwCD_jyJexA==/lib/arm64/libsubstrate.so"...�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at java.lang.Runtime.loadLibrary0(Runtime.java:1087)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at java.lang.Runtime.loadLibrary0(Runtime.java:1008)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at java.lang.System.loadLibrary(System.java:1664)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at com.gluonhq.helloandroid.MainActivity.surfaceCreated(MainActivity.java:104)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.SurfaceView.updateSurface(SurfaceView.java:1275)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.SurfaceView.lambda$new$0$SurfaceView(SurfaceView.java:196)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.-$$Lambda$SurfaceView$w68OV7dB_zKVNsA-r0IrAUtyWas.onPreDraw(Unknown Source:2)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1111)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3402)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2181)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8647)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1031)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.Choreographer.doCallbacks(Choreographer.java:849)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.Choreographer.doFrame(Choreographer.java:779)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.view.Choreographer$FrameHandler.handleMessage(Choreographer.java:954)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.os.Handler.dispatchMessage(Handler.java:106)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.os.Looper.loop(Looper.java:239)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at android.app.ActivityThread.main(ActivityThread.java:8205)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at java.lang.reflect.Method.invoke(Native Method)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626)�[0m
[Mon Jun 21 15:36:10 PKT 2021][INFO] [SUB] �[38;5;196mE/AndroidRuntime(32022): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1016)�[0m
[Mon Jun 21 15:38:49 PKT 2021][FINE] Result for log: 130

Still this error is confusing, why this is coming however I am not using any AWT.

@ctoabidmaqbool
Copy link
Author

This error e.g. dlopen failed: cannot locate symbol "JNI_OnLoad_awt" referenced by "/data/app/~~39LXkPgmTrISwC1MPz0-aw==/com.maqboolsolutions.myproject-h6E02fzSpPHVwCD_jyJexA==/lib/arm64/libsubstrate.so" also happened when using this library:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.30</version>
</dependency>

& Running native APK on Android e.g. mvn -Pandroid gluonfx:nativerun

@ctoabidmaqbool
Copy link
Author

ctoabidmaqbool commented Jun 24, 2021

oracle/graal#3406 (reference)
here is another issue, where discussion on this issue is going on already.

@jperedadnr
Copy link
Contributor

There is no support yet for AWT on Android, so any library that makes use of it should be excluded, if possible.

@makingthematrix
Copy link

makingthematrix commented Jul 22, 2021

@jperedadnr : Is it possible that it doesn't actually fail because AWT, but it's connected with this old bug?
gluonhq/substrate#840
I'm trying to run an Android app with FXGL, a game engine. It doesn't use AWT by itself, but it's enough to add it to dependencies to get exactly this error, even if I never use it in the code.

@jperedadnr
Copy link
Contributor

jperedadnr commented Jul 28, 2021

I don't see any relation between possible use of AWT with gluonhq/substrate#840

I can't reproduce the issue deploying HelloGluon to Android with plugin 1.0.3 and Gluon's GraalVM, even if I add either slf4j-log4j12 or commons-configuration2 dependencies.
However, I can reproduce it with https://github.com/robert-picking/hellofx-jni-awt-bug and plugin 1.0.3

@ctoabidmaqbool
Copy link
Author

@jperedadnr Noop, I think the above error is still exists even in v. latest Gluonfx plugin & GraalVM.

See, I have uploaded a simple project here where this error is happening.

Logs files: client-debug0.log & client-debug0.log.1

I have run this command for testing:

mvn clean -Pandroid gluonfx:build gluonfx:package gluonfx:install gluonfx:nativerun

In other branch this error is not there, because
slf4j-log4j12 lib is not used.

system info:

$ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment GraalVM 21.2.0-dev (build 11.0.11+8-jvmci-21.2-b02)
OpenJDK 64-Bit Server VM GraalVM 21.2.0-dev (build 11.0.11+8-jvmci-21.2-b02, mixed mode, sharing)

Window 10 with WSL (Ubuntu)

@ctoabidmaqbool ctoabidmaqbool changed the title Error when running Graalvm Native APK, java.lang.UnsatisfiedLinkError: undefined symbol: _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9underflowEv Error when running APK generated by GraalVM native-image, java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_awt" referenced by "/data/app/~~ySAMTz_BRuG3hf0ioN_Hlw==/com.maqboolsolutions.HSQLDbOnGraalVMNativeImageTest-DWGgBp_MoA4FsRHyKUPv3Q==/lib/arm64/libsubstrate.so"... Jul 29, 2021
@jperedadnr jperedadnr changed the title Error when running APK generated by GraalVM native-image, java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_awt" referenced by "/data/app/~~ySAMTz_BRuG3hf0ioN_Hlw==/com.maqboolsolutions.HSQLDbOnGraalVMNativeImageTest-DWGgBp_MoA4FsRHyKUPv3Q==/lib/arm64/libsubstrate.so"... Error when running APK generated by GraalVM native-image, java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_awt" Jul 30, 2021
@jperedadnr
Copy link
Contributor

There is a tentative workaround to avoid AWT references on Android, providing AWT is not used explicitly by the project.
To test it use:

gluonfx-maven-plugin version: 1.0.4-SNAPSHOT

plugin repository:

    <pluginRepositories>
        <pluginRepository>
            <id>Snapshots</id>
            <url>http://oss.sonatype.org/content/repositories/snapshots/</url>
        </pluginRepository>
    </pluginRepositories>

@ctoabidmaqbool
Copy link
Author

@jperedadnr That error have been resolved by using above method, but facing again another one e.g.

[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100): FATAL EXCEPTION: main
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100): Process: com.maqboolsolutions.HSQLDbOnGraalVMNativeImageTest, PID: 18100
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JVM_FillInStackTrace" referenced by "/data/app/~~91Rl_r6D8mgevKOojkPHng==/com.maqboolsolutions.HSQLDbOnGraalVMNativeImageTest-4wMQld7Ri1zgOj5h49KPZQ==/lib/arm64/libsubstrate.so"...
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at java.lang.System.loadLibrary(System.java:1664)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at com.gluonhq.helloandroid.MainActivity.surfaceCreated(MainActivity.java:104)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.SurfaceView.updateSurface(SurfaceView.java:1275)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.SurfaceView.lambda$new$0$SurfaceView(SurfaceView.java:196)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.-$$Lambda$SurfaceView$w68OV7dB_zKVNsA-r0IrAUtyWas.onPreDraw(Unknown Source:2)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1111)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3402)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2181)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8647)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1031)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.Choreographer.doCallbacks(Choreographer.java:849)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.Choreographer.doFrame(Choreographer.java:779)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.view.Choreographer$FrameHandler.handleMessage(Choreographer.java:954)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.os.Handler.dispatchMessage(Handler.java:106)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.os.Looper.loop(Looper.java:239)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at android.app.ActivityThread.main(ActivityThread.java:8212)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at java.lang.reflect.Method.invoke(Native Method)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626)
[Sat Jul 31 11:04:43 PKT 2021][INFO] [SUB] E/AndroidRuntime(18100):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1016)

Complete log file client-debug0.log

See complete project at https://github.com/ctoabidmaqbool/HSQLDb-On-GraalVM-NativeImage-Test

@mipastgt
Copy link

Yes, that is similar to the ULE "JVM_GetStackAccessControlContext" I get now too. (gluonhq/substrate#970) There seems to be something completely broken.

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