Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter build appbundle "can't find dynamically referenced class android.util.LongArray"

While running flutter build appbundle in my Flutter app, my build fails with this error:

Note: io.flutter.view.AccessibilityViewEmbedder$ReflectionAccessors: can't find dynamically referenced class android.util.LongArray
Note: there were 1 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.  
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)

The closest thing I've found about this is this issue.

Can anyone point me in the right direction of how to go about resolving this issue? Can I update my android.jar file to include the LongArray.java file somehow? Should I figure out where the LongArray class is referenced and try to delete it?

It's hard to make an MRE for something like this, but any pointers would be helpful.

(PS. I'm using Android Studio on Linux to develop the app.)

like image 423
Alex P. Miller Avatar asked Feb 12 '26 04:02

Alex P. Miller


1 Answers

I was stuck with the same issue at the moment of building my app. According to this git post here is flutter.jar related. You just need to add

-dontwarn io.flutter.embedding.**

to your /android/app/proguard-rules.pro file in the project folder.

This is because flutter.jar doesn't bring the AndroidX dependencies.

UPDATE: with flutter 1.9.1+hotfi.2 there is a new error related with WindowInsets. A workaround is add -dontwarn android.** in the file mentioned. Info: here

like image 125
Pepe Avatar answered Feb 14 '26 17:02

Pepe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!