如何解决flutter cloud_firestore依赖性?

时间:2019-09-07 09:34:51

标签: android gradle flutter google-cloud-firestore

我正在研究cloud_firestore的Flutter应用程序。 在我将pubspec.yaml中添加“ cloud_firestore:^ 0.9.0”之前,我的应用程序运行正常

dependencies:
  flutter:
    sdk: flutter
  cloud_firestore: 

我试图将cloud_firestore的版本更改为0.8.2甚至根本不包含版本。但我仍然无法正常工作。 我还尝试将“ android \ app \ build.gradle”中的minSdkVersion从16更改为21。

  defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.baby_names"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

这是错误消息。

* Error running Gradle:
ProcessException: Process "D:\BeatMil\MakeApp\baby_names\android\gradlew.bat" exited abnormally:

> Configure project :cloud_firestore

Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':cloud_firestore'.
> Could not open cp_proj remapped class cache for 9rdd22t0lqqejbejjys4b4x3q (C:\Users\anuto\.gradle\caches\4.10.2\scripts-remapped\build_d998a31vo7rwlu75ja03b8zq8\9rdd22t0lqqejbejjys4b4x3q\cp_proj70b1361a260e0ceb212a59c45f680ebd).
   > Unexpected lock protocol found in lock file. Expected 3, found 0.

* 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 0s
  Command: D:\BeatMil\MakeApp\baby_names\android\gradlew.bat app:properties

Please review your Gradle project setup in the android/ folder.

我的应用无法再启动。我需要帮助。 预先谢谢你。

1 个答案:

答案 0 :(得分:1)

更新:因此我将cloud_firestore版本更改为0.3.0,并且可以正常工作。

我认为这可能与SDK版本有关。我不确定。我不是专家。

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  cloud_firestore: ^0.3.0
  flutter:
    sdk: flutter