Issue with integration Rust ble library with android app

I created a ble library in Rust and try to integrate with android app makes crash always. Unable to load JNI modules. Is it really possible using Rust Ble module with android and ios app??

What is the exact crash message?

06-05 12:52:05.302 13234 13234 F libc : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 13234 (.example.bleapp), pid 13234 (.example.bleapp)

06-05 12:52:05.611 13289 13289 F DEBUG : Process name is com.example.bleapp, uid is 10376, not key_process

06-05 12:52:05.611 13289 13289 F DEBUG : keyProcess: 0

06-05 12:52:05.611 13289 13289 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

06-05 12:52:05.611 13289 13289 F DEBUG : Build fingerprint: 'OnePlus/CPH2613IN/OP5D3FL1:15/TP1A.220905.001/U.R4T2.1d5d92e-7387-7386:user/release-keys'

06-05 12:52:05.611 13289 13289 F DEBUG : Revision: '0'

06-05 12:52:05.611 13289 13289 F DEBUG : ABI: 'arm64'

06-05 12:52:05.611 13289 13289 F DEBUG : Timestamp: 2025-06-05 12:52:05.414617256+0530

06-05 12:52:05.611 13289 13289 F DEBUG : Process uptime: 1s

06-05 12:52:05.611 13289 13289 F DEBUG : Cmdline: com.example.bleapp

06-05 12:52:05.611 13289 13289 F DEBUG : pid: 13234, tid: 13234, name: .example.bleapp >>> com.example.bleapp <<<

06-05 12:52:05.611 13289 13289 F DEBUG : uid: 10376

06-05 12:52:05.611 13289 13289 F DEBUG : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)

06-05 12:52:05.611 13289 13289 F DEBUG : pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)

06-05 12:52:05.611 13289 13289 F DEBUG : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------

06-05 12:52:05.611 13289 13289 F DEBUG : x0 0000000000000000 x1 00000000000033b2 x2 0000000000000006 x3 0000007fd5119d00

06-05 12:52:05.611 13289 13289 F DEBUG : x4 000000000000000a x5 000000000000000a x6 000000000000000a x7 73722e696e6a2f63

06-05 12:52:05.611 13289 13289 F DEBUG : x8 00000000000000f0 x9 0000007b152ad338 x10 ffffff80fffffb9f x11 0000000000000001

06-05 12:52:05.611 13289 13289 F DEBUG : x12 0000000000000096 x13 000000000000003f x14 0000000000000000 x15 0000007fd5119b78

06-05 12:52:05.611 13289 13289 F DEBUG : x16 0000007b15393e50 x17 0000007b1537dfc0 x18 0000007b20028000 x19 00000000000033b2

06-05 12:52:05.611 13289 13289 F DEBUG : x20 00000000000033b2 x21 00000000ffffffff x22 0000007fd5119f00 x23 00000079cf0f0058

06-05 12:52:05.611 13289 13289 F DEBUG : x24 b400007a28d3fb00 x25 0000000000000001 x26 0000007fd511a080 x27 b400007a28dffe60

06-05 12:52:05.611 13289 13289 F DEBUG : x28 0000007b20f72039 x29 0000007fd5119d80

06-05 12:52:05.611 13289 13289 F DEBUG : lr 0000007b15319a68 sp 0000007fd5119ce0 pc 0000007b15319a98 pst 0000000000001000

06-05 12:52:05.611 13289 13289 F DEBUG : 14 total frames

06-05 12:52:05.611 13289 13289 F DEBUG : backtrace:

06-05 12:52:05.611 13289 13289 F DEBUG : #00 pc 0000000000092a98 /apex/com.android.runtime/lib64/bionic/libc.so (abort+172) (BuildId: a3cde331295ff116d9c0d5e2198af1eb)

06-05 12:52:05.611 13289 13289 F DEBUG : #01 pc 0000000000099f34 /data/app/~~56upqrJpAARorjHa4kEYaw==/com.example.bleapp-S4BQLbipmF66Or90PU8LqQ==/base.apk (offset 0x4000) (std::sys::pal::unix::abort_internal::h2e5e18fdc1d9f60d+8)

06-05 12:52:05.611 13289 13289 F DEBUG : #02 pc 0000000000098128 /data/app/~~56upqrJpAARorjHa4kEYaw==/com.example.bleapp-S4BQLbipmF66Or90PU8LqQ==/base.apk (offset 0x4000) (_RNvCscSpY9Juk0HT_7___rustc10rust_panic+92)

06-05 12:52:05.611 13289 13289 F DEBUG : #03 pc 0000000000097f74 /data/app/~~56upqrJpAARorjHa4kEYaw==/com.example.bleapp-S4BQLbipmF66Or90PU8LqQ==/base.apk (offset 0x4000) (std::panicking::rust_panic_with_hook::h8dd2a457981aa224+436)

06-05 12:52:05.611 13289 13289 F DEBUG : #04 pc 0000000000097cd0 /data/app/~~56upqrJpAARorjHa4kEYaw==/com.example.bleapp-S4BQLbipmF66Or90PU8LqQ==/base.apk (offset 0x4000) (std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h460c8c7b829e88aa+132)

06-05 12:52:05.611 13289 13289 F DEBUG : #05 pc 00000000000965e8 /data/app/~~56upqrJpAARorjHa4kEYaw==/com.example.bleapp-S4BQLbipmF66Or90PU8LqQ==/base.apk (offset 0x4000) (std::sys::backtrace::__rust_end_short_backtrace::h29c5a669537ba82f+8)

06-05 12:52:05.611 13289 13289 F DEBUG : #06 pc 0000000000097980 /data/app/~~56upqrJpAARorjHa4kEYaw==/com.example.bleapp-S4BQLbipmF66Or90PU8LqQ==/base.apk (offset 0x4000) (_RNvCscSpY9Juk0HT_7___rustc17rust_begin_unwind+28)

06-05 12:52:05.611 13289 13289 F DEBUG : #07 pc 00000000000b436c /data/app/~~56upqrJpAARorjHa4kEYaw==/com.example.bleapp-S4BQLbipmF66Or90PU8LqQ==/base.apk (offset 0x4000) (core::panicking::panic_fmt::h23af1c250d3d03f8+28)

06-05 12:52:05.611 13289 13289 F DEBUG : #08 pc 00000000000b4698 /data/app/~~56upqrJpAARorjHa4kEYaw==/com.example.bleapp-S4BQLbipmF66Or90PU8LqQ==/base.apk (offset 0x4000) (core::result::unwrap_failed::hadb57f9110043fd7+88)

06-05 12:52:05.611 13289 13289 F DEBUG : #09 pc 000000000004f2ac /data/app/~~56upqrJpAARorjHa4kEYaw==/com.example.bleapp-S4BQLbipmF66Or90PU8LqQ==/base.apk (offset 0x4000) (JNI_OnLoad+4356)

06-05 12:52:05.611 13289 13289 F DEBUG : #10 pc 0000000000583b40 /apex/com.android.art/lib64/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator> const&, _jobject*, _jclass*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>*)+1280) (BuildId: 4ccb65ae9ac5ad5da3af5a342d5b0b92)

06-05 12:52:05.611 13289 13289 F DEBUG : #11 pc 0000000000005914 /apex/com.android.art/lib64/libopenjdkjvm.so (JVM_NativeLoad+356) (BuildId: ee01ddb5e82126991cafcbd31e55fd49)

06-05 12:52:05.611 13289 13289 F DEBUG : #12 pc 000000000037ef70 /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: 4ccb65ae9ac5ad5da3af5a342d5b0b92)

06-05 12:52:05.611 13289 13289 F DEBUG : #13 pc 000000000201fcc8 /memfd:jit-cache (deleted) (offset 0x2000000)

My question is is it a good idea that Rust ble library to be integrated with Android and IOS app. My thought is presently we write ble code in kotlin for android and in swift for IOS. Instead of writing same logic in two different platforms, I thought I can write ble logic in Rust and can be integrated with Android and iOS to show productivity. But at each step, integration is not even successful for simple add function which written in Rust and integrated with Android app.please recommended.

An unwrap somewhere in your code is failing. The panic message should be a bit earlier in the logs.

1 Like

My main question is is it a good attempt to integrate rust library to android app and ios app?