Skip to content
Advertisement

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:UsersJaffStudioProjectspriv_chatandroidappbuild.gradle:

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

C:srcflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-3.4.0androidsrcmainjavaioflutterpluginsfirebasefirestorestreamhandlerTransactionStreamHandler.java:13: error: cannot find symbol import com.google.firebase.firestore.TransactionOptions; symbol: class TransactionOptions location: package com.google.firebase.firestore C:srcflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-3.4.0androidsrcmainjavaioflutterpluginsfirebasefirestorestreamhandlerTransactionStreamHandler.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?

Advertisement

Answer

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 🙂

Advertisement