Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 553
Ja'afar Zakariya Avatar asked Oct 20 '25 04:10

Ja'afar Zakariya


2 Answers

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 :)

like image 50
AndrewSheetMetal Avatar answered Oct 22 '25 19:10

AndrewSheetMetal


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 :)

like image 20
AndrewSheetMetal Avatar answered Oct 22 '25 18:10

AndrewSheetMetal