Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Execution failed for task ':app:transformClassesWithMultidexlistForDebug' #3

Closed
1 of 2 tasks
j3g opened this issue Apr 24, 2019 · 4 comments
Closed
1 of 2 tasks

Comments

@j3g
Copy link
Contributor

j3g commented Apr 24, 2019

🐛 Bug Report

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

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: android.support.v4.os.ResultReceiver$MyResultReceiver

  • 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 10s


The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.


Finished with error: Gradle task assembleDebug failed with exit code 1

Expected behavior

Reproduction steps

after adding location_permissions library I receive an error in the android build process

Configuration

environment:
sdk: ">=2.1.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

cupertino_icons: ^0.1.2
numberpicker: ^1.0.0
google_maps_flutter: ^0.5.5
location_permissions: ^1.0.2

dev_dependencies:
flutter_test:
sdk: flutter

Version: 1.x

Platform:

  • 📱 iOS
  • 🤖 Android
@j3g
Copy link
Contributor Author

j3g commented Apr 24, 2019

my apologies that bug report is kind of messy. basically when I add this flutter-permission-handlers library I get multi dex issues. I am new to flutter so I am using default (flutter generated) settings for gradle files. I tried 'flutter clean'. I tried "multiDexEnabled true" in build.gradle. I continue to troubleshoot. Some tips say it might be related to AndroidX, but again I'm using all default flutter build configs so I don't know why that would be the cause.

@j3g
Copy link
Contributor Author

j3g commented Apr 24, 2019

after adding defaultConfig { multiDexEnabled true } to build.properties I was receiving a different error:
':app:transformClassesWithMultidexlistForDebug',
so I researched that. there are several multi dex issues open/closed:
flutter/flutter#23929
flutter/flutter#23131

@j3g j3g changed the title D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver Execution failed for task ':app:transformClassesWithMultidexlistForDebug' Apr 24, 2019
@j3g
Copy link
Contributor Author

j3g commented Apr 24, 2019

FIXED
I added to location_permissions build.gradle

android {
    defaultConfig {
        multiDexEnabled true
}

I added to gradle.properties

android.useAndroidX=true
android.enableJetifier=true

@mvanbeusekom
Copy link
Member

Thanks for the fix! I have merged your pull-request and will release a new version shortly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants