Open pnwk112 opened 2 months ago
is anyone else facing this issue ?
It seems that some plugin-related classes and native methods are being omitted during the release build.
Try creating a android/app/proguard-rules.pro file in the project and then attempt the build again.
I'm not sure whether this file needs to be created at the plugin level or within the example app, but I wrote it in both places, and the build succeeded.
This resolved the release build failure issue for me in the Android environment. I hope this answer helps.
Here is the content of the proguard-rules.pro file:
-dontwarn javax.annotation.Nullable
-keep class org.pytorch.** { *; }
-keep class com.facebook.jni.** { *; }
# Preserve plugin classes
-keep class com.spring98.yolo_realtime_plugin.** { *; }
-keep class com.spring98.yolo_realtime_plugin_example.** { *; }
-keepclassmembers class com.spring98.yolo_realtime_plugin.** { *; }
-keepclassmembers class com.spring98.yolo_realtime_plugin_example.** { *; }
# Preserve interfaces and their implementations
-keep interface com.spring98.yolo_realtime_plugin.** { *; }
-keep interface com.spring98.yolo_realtime_plugin_example.** { *; }
# Preserve native methods related to plugins
-keepclasseswithmembernames class * {
native <methods>;
}
Hello. When I build the example app in release mode app crashes during model initialization. Any ideas how to fix that?
[✓] Flutter (Channel stable, 3.22.3, on macOS 14.5 23F79 darwin-arm64, locale pl-PL) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.92.2) [✓] Connected device (4 available)