From 1d31e472226f4fb7ec817333b0b6c816eb163e21 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 17 May 2024 20:17:19 +0200 Subject: [PATCH] Fix class loading issue with GraalVM Only use the class loader cache workaround on Android. --- rust/bridge/jni/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust/bridge/jni/src/lib.rs b/rust/bridge/jni/src/lib.rs index f909112e0..55646d8f1 100644 --- a/rust/bridge/jni/src/lib.rs +++ b/rust/bridge/jni/src/lib.rs @@ -50,11 +50,16 @@ pub unsafe extern "C" fn Java_org_signal_libsignal_internal_Native_initializeLib class: JClass<'local>, ) { run_ffi_safe(&mut env, |env| { + #[cfg(target_os = "android")] save_class_loader(env, &class)?; #[cfg(target_os = "android")] set_up_rustls_platform_verifier(env, class)?; + // Silence the unused variable warning on non-Android. + _ = class; + _ = env; + Ok(()) }) }