【问题标题】:Flutter Conflict: geolocator: ^5.1.4+1 and google_maps_flutter: ^0.5.21+7 generate dependency conflictFlutter Conflict: geolocator: ^5.1.4+1 and google_maps_flutter: ^0.5.21+7 产生依赖冲突
【发布时间】:2020-02-09 21:03:41
【问题描述】:

目前我正在做一个 Flutter 应用程序女巫使用:

  geolocator: ^5.1.4+1
  google_maps_flutter: ^0.5.21+7

当我在“pubspec.yaml”中声明两个依赖项时,它会发生冲突

"FAILURE: Build failed with an exception.

  • 出了什么问题:

    Execution failed for task ':app:preDebugBuild'.

    Android 依赖 'com.google.android.gms:play-services-tasks' 对于编译 (16.0.1) 和运行时 (17.0.0) 类路径有不同的版本。您应该通过 DependencyResolution 手动设置相同的版本”

  • 我也尝试过编辑 gradle.properties:

   android.useAndroidX=true
   android.enableJetifier=true

并且在"app/build.gradle" 中根据需要将依赖项添加为类路径和/或api:

com.google.android.gms:play-services-tasks

有人遇到同样的问题吗?如果你解决了它,你做了什么来解决它?

【问题讨论】:

    标签: flutter dart google-maps-flutter


    【解决方案1】:

    虽然使用google_maps_flutter0.5.21+8,但我遇到了完全相同的问题。 我为每个错误消息添加了以下行到依赖项下的android/app/build.gradle。然后看起来像下面这样:

    dependencies {
        ...
    
        implementation 'androidx.cursoradapter:cursoradapter:1.0.0'
        implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
        implementation 'androidx.documentfile:documentfile:1.0.0'
        implementation 'androidx.viewpager:viewpager:1.0.0'
        implementation 'androidx.arch.core:core-runtime:2.0.0'
        implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
        implementation 'androidx.fragment:fragment:1.0.0'
        implementation 'androidx.core:core:1.1.0'
        implementation 'com.google.android.gms:play-services-basement:17.0.0'
        implementation 'com.google.android.gms:play-services-base:17.0.0'
    }
    

    希望对您有所帮助。如果有更好的方法请告诉。目前还没有 Flutter 专家。

    【讨论】:

      猜你喜欢
      • 2022-01-24
      • 1970-01-01
      • 2020-01-15
      • 1970-01-01
      • 2021-06-06
      • 2011-03-12
      • 2019-12-24
      • 2021-12-14
      相关资源
      最近更新 更多