当我运行应用程序时未添加图像选择器作为依赖项时,它运行良好。但是,当我添加插件并运行时,它给了我gradle构建失败的错误。
Resolving dependencies... 5.0s
Gradle task 'assembleDebug'...
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
D8: Program type already present: android.support.v4.app.INotificationSideChannel
*********************************************************
WARNING: This version of image_picker will break your Android build if it or its dependencies aren't compatible with AndroidX.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
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: D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\142.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\118.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\94.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\124.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\88.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\136.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\157.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\103.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\163.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\151.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\127.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\100.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\166.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\139.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\97.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\115.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\160.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\169.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\106.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\154.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\148.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\112.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\172.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\133.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\109.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\91.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\121.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\130.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\145.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\27.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\52.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\18.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\43.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\19.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\51.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\60.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\36.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\34.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\42.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\28.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\50.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\33.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\37.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\2.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\9.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\25.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\45.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\32.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\38.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\39.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\44.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\57.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\26.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\8.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\31.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\30.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\56.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\13.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\14.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\21.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\49.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\7.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\12.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\15.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\55.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\58.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\6.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\20.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\46.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\11.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\59.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\24.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\29.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\54.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\16.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\41.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\5.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\10.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\3.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\17.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\23.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\47.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\40.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\53.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\35.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\4.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\48.jar, D:\fluuter_projects\motor_app_demo\build\app\intermediates\transforms\dexBuilder\debug\22.jar
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel
* 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 22s
Gradle task 'assembleDebug'... Done 23.7s
Gradle task assembleDebug failed with exit code 1
答案 0 :(得分:3)
由于Android X支持... 避免AndroidX并回滚到旧版本的简单解决方案 依赖项: image_picker:0.4.12 + 1
或
将Flutter应用迁移到AndroidX 将Flutter应用程序导入Android Studio中,以便IDE可以按照具有完整IDE支持的在Android Studio中编辑Android代码中的步骤来解析Android代码。
按照有关迁移到AndroidX的说明进行操作。
https://flutter.io/docs/development/packages-and-plugins/androidx-compatibility