marcolav
marcolav

Reputation: 485

Flutter Error: cannot find symbol import com.google.firebase.firestore.TransactionOptions

Since the latest update to Cloud Firestore 3.4.3 I cannot build the Flutter app anymore.

    /Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3/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
/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3/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(),
                                  ^
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 9s
Exception: Gradle task assembleDebug failed with exit code 1
Exited

I tried removing the folder /Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3 and performing flutter clean. Moreover I downgraded cloud_firestore to 3.3.0, but the folder was reinstalled with the same 3.4.3 version.

Any suggestion?

Upvotes: 3

Views: 1073

Answers (1)

willbradley
willbradley

Reputation: 724

Here's everything I did to get that error gone.

Per this link:

flutter upgrade --force --verbose&&flutter update-packages --force-upgrade&&flutter pub upgrade --major-versions

Add to my main.dart:

import 'package:firebase_auth_platform_interface/firebase_auth_platform_interface.dart' show FirebaseAuthPlatform;

Run flutter pub get -- notice no improvement.

So, additionally, I upgrade my pubspec.yaml manually:

firebase_core: ^1.21.0
cloud_firestore: ^3.3.0
firebase_auth: ^3.6.4
firebase_auth_platform_interface: ^6.5.4
cloud_firestore_odm: ^1.0.0-dev.27

Run flutter pub upgrade && flutter pub get

Now it works.

Upvotes: 2

Related Questions