无法确定任务':app:preDebugBuild'的依赖关系

时间:2019-08-17 14:27:26

标签: firebase flutter

在创建应用程序之前,我正在构建具有Firebase依赖关系的应用程序,我已经完成了Firebase配置并在pubspec.yaml中添加了Firebase依赖关系。但是当我运行该应用程序时,出现了一些错误。

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0.
  1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

  Dependency failing: com.google.android.gms:play-services-flags:15.0.1 -> com.google.android.gms:play-services-basement@[
  15.0.1], but play-services-basement version was 16.0.1.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends on project 'firebase_auth' which depends onto com.google.firebase:firebase-auth@16.0.2
  -- Project 'app' depends on project 'firebase_core' which depends onto com.google.firebase:firebase-core@16.0.4
  -- Project 'app' depends on project 'firebase_database' which depends onto com.google.firebase:firebase-database@15.+

  For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
  endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
  github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
  uild.gradle file.

* 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 2s
Finished with error: Gradle task assembleDebug failed with exit code 1

1 个答案:

答案 0 :(得分:1)

无法从jcenter服务器下载依赖时出现问题。 更改您的网络连接跟随flutter clean并重试

您仍然可以在调试模式下工作

flutter run --debug 会起作用

或者您可以在Android Studio中转到文件>设置>构建、执行、部署>构建工具>Gradle>取消选中离线工作选项

您也可以使缓存无效并重新启动