Need ProGuard rules in docs - app crashes in release mode but works fine in debug #2583
Open
1 task done
Labels
enhancement
New feature or request
Uh oh!
There was an error while loading. Please reload this page.
Have you checked for an existing issue?
Use case
The Problem I Hit
I just spent way too much time debugging why my app works perfectly in debug but crashes immediately in release mode. Turns out Flutter Quill needs specific ProGuard rules that aren't mentioned anywhere in the docs.
Here's what happened:
java.lang.NullPointerException:
Attempt to invoke virtual method 'void androidx.lifecycle.E.g(java.lang.String, w5.d)' on a null object reference
Spent hours thinking it was my code, Firebase, or some other package. The error message is completely unhelpful because of minification -
androidx.lifecycle.E.g()
tells me nothing.What's Actually Happening
When you build for release, Android's R8 minifier renames classes and methods. Flutter Quill uses lifecycle components internally, and when those get renamed, the app can't find them anymore and crashes.
This only happens in release builds because debug builds don't minify code.
Why This Sucks for Developers
I eventually figured out I needed to add ProGuard rules, but it took way longer than it should have.
Proposal
Just Add This to the README
Can we please add a simple section about Android release builds? Something like:
📱 Android Release Builds
If your app crashes on startup in release mode (but works in debug), you need to add these lines to
android/app/proguard-rules.pro
:The text was updated successfully, but these errors were encountered: