From 2838141b264176a3d07d01bd9ce578e13d97a54b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=BB=CF=89=E3=83=BB=EF=BC=88=E7=AB=B9=E5=AD=90?= =?UTF-8?q?=EF=BC=89?= Date: Wed, 21 Oct 2026 00:05:40 +0800 Subject: [PATCH] fix(android): preserve wind JNI callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Platform: android Fix(zh-Hant): 修正 Android 正式版開啟風場圖層時閃退 Fix(en-US): stop Android release builds crashing when wind layers open --- android/app/proguard-rules.pro | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 android/app/proguard-rules.pro diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro new file mode 100644 index 000000000..e41c34042 --- /dev/null +++ b/android/app/proguard-rules.pro @@ -0,0 +1,14 @@ +# JNI callbacks invoked by maplibre_gl's native WindParticleHost. +# R8 cannot see these calls because they originate in C++: without this rule a +# release build renames or drops all four, GetMethodID fails, and opening a +# wind layer crashes with NoSuchMethodError. Debug builds are not shrunk, so +# only a release build shows it. +# +# Flutter's Gradle plugin enables R8 for release builds and adds this file +# when it exists; build.gradle.kts needs no change for it to apply. +-keepclassmembers class org.maplibre.maplibregl.WindParticleLayer { + void onNativeInitialize(); + void onNativeRender(double, double, double, double, double, double); + void onNativeContextLost(); + void onNativeDeinitialize(); +}