Fixing `Execution failed for task ':firebase_auth:compileReleaseJavaWithJavac'. java.lang.NullPointerException (no error message)`

My Flutter app stopped compiling today, with the following exception:

Execution failed for task ':firebase_auth:compileReleaseJavaWithJavac'. > java.lang.NullPointerException (no error message)

A search led me to https://github.com/flutter/flutter/issues/27090, which states you should migrate to AndroidX by setting two variables in android/gradle.properties, and also setting compileSdkVersion and targetSdkVersion to 28. I check my config files and everything is already set up correctly, so it's something else.

Btw I'm using version 0.15.4 of firebase_auth and as of time of writing, the latest stable version is 0.18.1+2, and includes breaking changes from 0.18.0.

At this point I could cross fingers and:

  • flutter clean and flutter build apk
  • upgrade dependencies

Turns out a flutter clean did the trick. So yeah, I have no idea what happened!