rust-mobile / rust-android-examples

Various standalone Rust Android examples
120 stars 22 forks source link

Can't run after updating Rust dependencies #19

Open darkwater opened 5 days ago

darkwater commented 5 days ago

I'm trying to get the agdk-eframe example working with up-to-date dependencies:

[dependencies]
log = "0.4"
winit = { version = "0.30", features = [ "android-game-activity" ] }
wgpu = "23.0.0"
pollster = "0.4"
egui = "0.29"
eframe = { version = "0.29", features = [ "wgpu", "android-game-activity" ] }
egui_demo_lib = "0.29"

[target.'cfg(not(target_os = "android"))'.dependencies]
env_logger = "0.11"

[target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.14.1"

It builds and installs fine, but on launch it immediately closes and I found this in logcat:

No implementation found for long com.google.androidgamesdk.GameActivity.loadNativeCode(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, android.content.res.AssetManager, byte[]) (tried Java_com_google_androidg
amesdk_GameActivity_loadNativeCode andJava_com_google_androidgamesdk_GameActivity_loadNativeCode__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Landroid_content_res_AssetManager_2_3B) - is the library loaded, e.g. System.loadLibrary? 

Do I need to update some dependencies on the Android side to match? I can't really find any android-activity <-> agdk version compatibility tables, for example.

DerFetzer commented 4 days ago

I am facing this problem, too. It seems that upgrading winit to 0.29 or greater and egui and eframe to corresponding versions causes this behavior. Unfortunately I am no android expert. Any ideas to debug this problem further?

DerFetzer commented 4 days ago

Just after writing my reply I found this pull request: https://github.com/podusowski/walkers/pull/141 So the solution is to simply bump the version of androidx.games:games-activity to 2.0.2 in your build.gradle.