当我包含google maps时,我的构建会失败

时间:2019-02-21 11:44:41

标签: google-maps build flutter

当我在pubspec.yaml中包含“谷歌地图”依赖项

google_maps_flutter: ^0.2.0+3

我的构建失败并显示:

在调试模式下为x86构建的Android SDK上启动lib \ main.dart ... D8:程序类型已经存在:android.support.v4.media.MediaBrowserCompat $ ConnectionCallback $ ConnectionCallbackInternal          ****************************************************** ******* 警告:如果此版本的google_maps_flutter或其依赖项与AndroidX不兼容,则它将破坏您的Android构建。          有关此问题及其解决方法的更多信息,请参见xxxxxxxxxxx。          此警告会针对所有Android构建失败进行打印。错误的真正根本原因可能无关。          ****************************************************** *******

失败:构建失败,并出现异常。

  • 出了什么问题: 任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败。
      

    com.android.builder.dexing.DexArchiveMergerException:合并dex存档时出错:C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 4.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 5.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 6.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 7.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 8.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 9.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 10.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 11.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 12.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 13.jar,C:\ Us ers \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 14.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 15.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 16.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 17.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 18.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 19.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 20.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 21.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 22.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 23.jar,C:\用户\ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 24.jar,C:\ U sers \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 25.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 26.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 27.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 28.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 29.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 30.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 31.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 32.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 33.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 34.jar,C:\用户\ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 35.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 36.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 50.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 55.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 60.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 65.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 70.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 75.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 80.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 85.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 90.jar,C:\用户\ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 95.jar,C: \ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 100.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 105.jar,C: \ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 110.jar,C:\ Users \ philb \ flutter_course2 \ build \ app \ intermediates \ transforms \ dexBuilder \ debug \ 115.jar

有人可以为我指出正确的方向,以理解和追踪这个问题。该项目以前的构建情况还不错。

1 个答案:

答案 0 :(得分:0)

这是因为您的应用程序中有使用androidx的google_maps_plugin版本,并且您的应用程序和/或某些其他依赖项正在使用android支持库。我提供了一些解决这类问题herehere的方法。 但是您需要做的是migrate all your app to androidx,并使用已经迁移的更新的依赖项版本。

另一种方法是avoid androidx降级androidx之前版本的依赖包。

有关flutter应用程序androidx迁移的更多详细信息,请参见原始文档reference

希望对您有帮助。