简体   繁体   中英

how do I fix my flutter app not building with cloud firestore?

So I am new to flutter and firebase and I wanted to add firestore capabilities to my app, but when I tried to use firestore I got an error

The plugin cloud_firestore requires a higher Android SDK version. │ │ Fix this issue by adding the following to the file │ │ C:\Users\Jaff\StudioProjects\priv_chat\android\app\build.gradle:

After fixing the SDK version, then I got another error,

C:\src\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-3.4.0\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java:13: error: cannot find symbol import com.google.firebase.firestore.TransactionOptions; symbol: class TransactionOptions location: package com.google.firebase.firestore C:\src\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-3.4.0\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java:66: error: package TransactionOptions does not exist new TransactionOptions.Builder().setMaxAttempts(maxAttempts).build(),

  • What went wrong: Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

This is where I got completely confused, I have no idea how to solve this, can somebody help me?

I had the same issue and noticed, that my firebase_core dependency in pubspec.yaml was not updated.

Now I use firebase_core: ^1.20.0 and it works 👍

Do not forget to run flutter clean .

Hope that helps :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM