Flutterfire: firebase_core: ^0.5.2 FAILURE: Build failed with an exception.

Created on 10 Nov 2020  Â·  4Comments  Â·  Source: FirebaseExtended/flutterfire

Works fine when I use firebase 0.5.0+1

firebase_core: ^0.5.2 generates:

D8: Program type already present: com.google.protobuf.ByteString$CodedBuilder

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
    > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
    Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
    Program type already present: com.google.protobuf.ByteString$CodedBuilder

Flutter doctor
/Users/stephan/development/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.7 19H2, locale en-NO)
• Flutter version 1.22.3 at /Users/stephan/development/flutter
• Framework revision 8874f21e79 (12 days ago), 2020-10-29 14:14:35 -0700
• Engine revision a1440ca392
• Dart version 2.10.3

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/stephan/Library/Android/sdk
• Platform android-30, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.1, Build version 12A7403
• CocoaPods version 1.9.3

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin installed
• Dart plugin version 201.9245
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (1 available)
• LYA L29 (mobile) • LHS7N18A13001240 • android-arm64 • Android 10 (API 29)

Needs Attention bug

Most helpful comment

Hi again,
It was a barcode_scan plugin (discontinued) that came in conflict with firebase.
Stephan

All 4 comments

Hi @StephanCassel
You need to enable multidex in your android app. Please follow https://developer.android.com/studio/build/multidex
Closing, as this isn't an issue with flutterfire itself. If you disagree, please write in the comments and I will reopen it.
Thank you

Hi @TahaTesser
Thanks for replay

I understand that is not necessary when minSdkVersion 21 and above.
"If your app only targets Android 21 or higher (minSdkVersion) then multidex is already enabled by default and you do not need the multidex support library."

Thanks again

Hi again,
It was a barcode_scan plugin (discontinued) that came in conflict with firebase.
Stephan

What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

This is usually thrown when multidex is not added and by default Flutter doesn't target API 21

Glad you resolved the issue since it was a third party. No action is needed

Was this page helpful?
0 / 5 - 0 ratings