Skip to content

Need ProGuard rules in docs - app crashes in release mode but works fine in debug #2583

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

Open
1 task done
PRATHAMESHG1234 opened this issue May 28, 2025 · 0 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@PRATHAMESHG1234
Copy link

PRATHAMESHG1234 commented May 28, 2025

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:

  • Added Flutter Quill to my app
  • Everything worked great in development
  • Built release APK for testing
  • App crashes on startup with this cryptic error:

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

  1. Works fine during development, fails in production - classic gotcha
  2. Error messages are garbage because of obfuscation
  3. No obvious connection to Flutter Quill in the crash logs
  4. Zero documentation about this anywhere

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:

# Flutter Quill lifecycle fix
-keep class androidx.lifecycle.** { *; }
-keep class * extends androidx.lifecycle.LifecycleObserver { *; }
@PRATHAMESHG1234 PRATHAMESHG1234 added the enhancement New feature or request label May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant