Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Android application stopped to build after last Flutter update

My new flutter version follows:

Flutter 3.13.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d211f42860 (7 days ago) • 2023-10-25 13:42:25 -0700
Engine • revision 0545f8705d
Tools • Dart 3.1.5 • DevTools 2.25.0

After upgrade I see following build error:

ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform firebase-analytics-ktx-21.5.0.aar (com.google.firebase:firebase-analytics-ktx:21.5.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=19, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: C:\Users\Vitaliy\.gradle\caches\transforms-3\41525bdf5de3383fe28a17aaa9610b1b\transformed\jetified-firebase-analytics-ktx-21.5.0-runtime.jar.
         > Error while dexing.
   > Failed to transform play-services-measurement-api-21.5.0.aar (com.google.android.gms:play-services-measurement-api:21.5.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=19, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: C:\Users\Vitaliy\.gradle\caches\transforms-3\ce1b8deb6ac5da9f5a47c5868d41ba4c\transformed\jetified-play-services-measurement-api-21.5.0-runtime.jar.
         > Error while dexing.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s

How to bypass this bug and still build the application?

Clearing caches, removing .gradle and similar folders change nothing.

like image 528
Vitalii Avatar asked Jan 28 '26 03:01

Vitalii


2 Answers

For me, the issue comes from adding built_value: 8.7.0 in the dependencies (either directly or indirectly), while using firebase_analytics plugin. And it will only occur if your app level(android/app/) build.gradle compileSdkversion is 34. An issue was created on flutterfire repo so lets wait for the fix.

One temporary workaround would be either

  • Reduce the compileSdkversion to 33 if its set to 34
  • Use older version of built_value

I didn't need to change anything else so see what works for you.

like image 94
Milind Goel Avatar answered Jan 30 '26 20:01

Milind Goel


I have the same issue, it seems this is some kind of bug. Downgrading to

 classpath 'com.android.tools.build:gradle:7.3.0'

seems to resolve this. More info could be found here: https://github.com/firebase/flutterfire/issues/11853

like image 37
MeLean Avatar answered Jan 30 '26 18:01

MeLean



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!