You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is caused by JNI local reference overflow: get_view_rect in internal/backends/android-activity/javahelper.rs. However, there might be more potential problems. High RAM usage might occur in some other applications on newer Android versions.
I do know how to fix the problem, but I am not sure if the jni-min-helper crate can be introduced as a dependency of i-slint-backend-android-activity.
Test case (it crashes on Android 6.0/7.0 in a few seconds):
[package]
name = "slint-test"version = "0.1.0"edition = "2021"publish = false
[dependencies]
slint = { version = "1.9.0", features = ["backend-android-activity-06"] }
[lib]
crate-type = ["cdylib"]
path = "lib.rs"
#[no_mangle]fnandroid_main(app: slint::android::AndroidApp){
slint::android::init(app).unwrap();
slint::slint!{
export component MainWindow inherits Window{
in property <image> screen_image;Image{
source: screen_image;}}}let window = MainWindow::new().unwrap();let window_weak = window.as_weak();let timer = slint::Timer::default();
timer.start(slint::TimerMode::Repeated, std::time::Duration::from_millis(1),move || {// image creation process is removed in this minimal test programlet pixel_buffer = slint::SharedPixelBuffer::<slint::Rgba8Pixel>::new(320,240);let img = slint::Image::from_rgba8_premultiplied(pixel_buffer);
window_weak.upgrade().unwrap().set_screen_image(img);});
window.run().unwrap();}
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] JNI ERROR (app bug): local reference table overflow (max=512)
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] local reference table dump:
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] Last 10 entries (of 511):
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 510: 0x12db2b20 android.graphics.Rect
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 509: 0x12db2b00 android.graphics.Rect
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 508: 0x12db2ae0 android.graphics.Rect
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 507: 0x12db2ac0 android.graphics.Rect
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 506: 0x12db2aa0 android.graphics.Rect
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 505: 0x12db2a80 android.graphics.Rect
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 504: 0x12db2a60 android.graphics.Rect
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 503: 0x12db2a40 android.graphics.Rect
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 502: 0x12db2a20 android.graphics.Rect
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 501: 0x12db2a00 android.graphics.Rect
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] Summary:
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 1 of dalvik.system.DexClassLoader
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 1 of SlintAndroidJavaHelper
12-20 21:15:43.347 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 4 of java.lang.Class (4 unique instances)
12-20 21:15:43.348 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 6 of java.lang.String (6 unique instances)
12-20 21:15:43.348 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 1 of dalvik.system.PathClassLoader
12-20 21:15:43.348 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 1 of java.io.FileOutputStream
12-20 21:15:43.348 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 1 of java.nio.DirectByteBuffer
12-20 21:15:43.348 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 1 of byte[] (16064 elements)
12-20 21:15:43.348 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 492 of android.graphics.Rect (492 unique instances)
12-20 21:15:43.348 24093 24107 F art : art/runtime/indirect_reference_table.cc:115] 3 of java.io.File (3 unique instances)
12-20 21:15:43.348 24093 24107 F art : art/runtime/indirect_reference_table.cc:115]
Besides, the virtual keyboard always prompt out on startup, maybe calling show_or_hide_soft_input(false) for once can fix the problem; the default material Slint style on Android currently features a pink color theme, which has nothing to do with the original material design style. It means a bad first impression for some people.
PS: docs.rs failed to build slint crate documentation because api/rs/slint/docs symbolic link has been deleted (commit e45e699). Would it be fixed?
The text was updated successfully, but these errors were encountered:
It is caused by JNI local reference overflow:
get_view_rect
ininternal/backends/android-activity/javahelper.rs
. However, there might be more potential problems. High RAM usage might occur in some other applications on newer Android versions.Reference: rust-mobile/android-activity#173, https://developer.android.com/training/articles/perf-jni#unsupported-featuresbackwards-compatibility. "In Android versions prior to Android 8.0, the number of local references is capped at a version-specific limit. Beginning in Android 8.0, Android supports unlimited local references."
I do know how to fix the problem, but I am not sure if the jni-min-helper crate can be introduced as a dependency of
i-slint-backend-android-activity
.Test case (it crashes on Android 6.0/7.0 in a few seconds):
Besides, the virtual keyboard always prompt out on startup, maybe calling
show_or_hide_soft_input(false)
for once can fix the problem; the defaultmaterial
Slint style on Android currently features a pink color theme, which has nothing to do with the original material design style. It means a bad first impression for some people.PS: docs.rs failed to build
slint
crate documentation becauseapi/rs/slint/docs
symbolic link has been deleted (commit e45e699). Would it be fixed?The text was updated successfully, but these errors were encountered: