Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate how to use shrinkResources/minifyEnabled in Android release builds #37

Open
nmfisher opened this issue Jun 17, 2024 · 0 comments
Labels

Comments

@nmfisher
Copy link
Owner

FilamentInterop.kt uses JNA on Android to resolve a handful of native methods (getting the native window, creating a resource loader, and a render callback).

In a standard Android release build, shrinkResources/minifyEnabled are set to true, but this will cause the following error at runtime:

E/flutter ( 6480): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, lateinit property _lib has not been initialized, null, e0.p: lateinit property _lib has not been initialized
E/flutter ( 6480):      at j.h.f(Unknown Source:140)
E/flutter ( 6480):      at z.i$a.a(Unknown Source:17)
E/flutter ( 6480):      at o.c.i(Unknown Source:18)
E/flutter ( 6480):      at o.c.j(Unknown Source:41)
E/flutter ( 6480):      at o.c.f(Unknown Source:0)

I haven't looked into this closely but clearly the minification is interfering with the dynamic resolution of the library and/or methods via JNA.

These two options are useful on Android to bring the release build size down, so we should investigate how we can use JNA with shrinkResources/minifyEnabled true (or alternatively, replace with JNI which I assume would avoid the issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant