rust-mobile / android-activity

Glue for building Rust applications on Android with NativeActivity or GameActivity
238 stars 46 forks source link

dlopen failed: cannot locate symbol "android_main" #166

Closed Its-Just-Nans closed 1 month ago

Its-Just-Nans commented 1 month ago

Hello

I am trying to get an eframe/egui app on android, my repo is here https://github.com/Its-Just-Nans/rust-apk

The Makefile is building the shared library using cargo-ndk then gradlew build the app

When the android app is starting, it always crash with

08-11 17:13:34.745  5047  5047 E AndroidRuntime: FATAL EXCEPTION: main
08-11 17:13:34.745  5047  5047 E AndroidRuntime: Process: local.eframe_template, PID: 5047
08-11 17:13:34.745  5047  5047 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "android_main" referenced by "/data/app/local.eframe_template-hKNmsSU9Dv1yDQ8pipfWGQ==/base.apk!/lib/x86_64/libeframe_template.so"...
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at java.lang.System.loadLibrary(System.java:1669)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at local.eframe_template.MainActivity.<clinit>(MainActivity.java:19)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at java.lang.Class.newInstance(Native Method)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:193)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6669)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
08-11 17:13:34.745  5047  5047 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Do you have any idea why ?

Its-Just-Nans commented 1 month ago

nevermind