Flutter升级后的Flutter Cloud Firestore错误

时间:2019-09-12 16:08:19

标签: flutter google-cloud-firestore flutter-dependencies

使用Flutter v1.9.1 + hotfix.2,尝试构建要发布的Android时出现以下错误。发布版本在设备上运行良好。 iOS版本构建良好。 Flutter Doctor的输出和软件包也在下面列出。

我尝试了多种建议的解决方案,例如确保已迁移到androidX。将Android minSdkVersion设置为23或其他多个操作均未成功。

  

/Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase /cloudfirestore/CloudFirestorePlugin.java:100:   错误:找不到符号       返回getFirestore(arguments).collectionGroup(path);
                                    ^符号:方法collectionGroup(String)
  位置:类FirebaseFirestore
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:128:   警告:[未选中]未选中的演员表       地图documentData =(地图)document.get(“数据”);                                                                            ^必填:地图
  找到:对象
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:135:   警告:[未选中]未选中的演员表             地图当前=(地图)documentData.get(fieldNameParts [0]);                                                                                 ^必填:地图
  找到:对象
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:137:   警告:[未选中]未选中的演员表               当前=(地图)current.get(fieldNameParts [i]);                                                          ^必填:地图
  找到:对象
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:187:   警告:[未选中]未选中的转换         地图元数据=新的HashMap();
                                       ^必填:地图
  找到的:HashMap
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:230:   错误:找不到符号           query = query.whereArrayContains(fieldName,value);
                       ^符号:方法whereArrayContains(String,Object)
  location:Query类型的变量查询
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:466:   警告:[未选中]未选中的转换                   地图元数据=新的HashMap();
                                                 ^必填:地图
  找到的:HashMap
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:808:   错误:找不到符号               builder.setCacheSizeBytes((((Integer)arguments.get(“ cacheSizeBytes”))。longValue());                      ^符号:setCacheSizeBytes(long)方法
  位置:Builder类型的变量builder
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:889:   错误:找不到符号           返回FieldValue.arrayUnion(toArray(readValue(buffer)));
                           ^符号:方法arrayUnion(Object [])
  位置:类FieldValue
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:891:   错误:找不到符号           返回FieldValue.arrayRemove(toArray(readValue(buffer)));
                           ^符号:方法arrayRemove(Object [])
  位置:类FieldValue
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:898:   错误:找不到符号           返回FieldValue.increment(integerIncrementValue.intValue());
                           ^符号:方法增量(int)
  位置:类FieldValue
  /Users/chris/Development/Packages/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/ CloudFirestorePlugin.java:901:   错误:找不到符号           返回FieldValue.increment(doubleIncrementValue.doubleValue());                            ^符号:方法增量(双精度)
  位置:类FieldValue

Flutter Doctor输出:

  

医生摘要(要查看所有详细信息,请运行flutter doctor -v):[✓]   Flutter(频道稳定,v1.9.1 + hotfix.2,在Mac OS X 10.14.6 18G95上,   语言环境en-ZA)[✓] Android工具链-为Android设备开发   (Android SDK版本29.0.2)[✓] Xcode-为iOS和macOS开发   (Xcode 10.3)[✓] Android Studio(版本3.5)[✓] VS Code(版本   1.38.1)[✓]已连接的设备(2个可用)   •找不到问题!

包装:

  

版本:1.0.1 + 21

     

环境:sdk:“> = 2.2.2 <3.0.0”

     

依赖性:颤动:       sdk:颤抖

     

intl:^ 0.15.8图片:^ 2.1.4 rxdart:^ 0.22.0提供程序:^ 2.0.1
  file_picker:^ 1.3.7 fluttertoast:^ 3.1.0 url_launcher:^ 5.0.3
  image_picker:^ 0.6.0 + 10 cupertino_icons:^ 0.1.2 bottom_navy_bar:   ^ 5.1.0 firebase_auth:^ 0.11.1 + 7 geoflutterfire:^ 2.0.3 + 5
  in_app_purchase:0.2.0 + 4 firebase_storage:^ 3.0.2
  slide_up_panel:^ 0.3.4 cloud_firestore:“ 0.12.9”
  cached_network_image:^ 1.0.0 google_places_picker:^ 2.0.2 + 1

1 个答案:

答案 0 :(得分:-2)

请在pubspec.yaml文件中包含firebase_core: ^0.4.0+1

然后运行“获取软件包”。然后使用您的代码。 它应该运行良好。添加依赖项后,其他运行flutter clean。 有关进一步的安装指南,请查阅官方文档。 FireBaseCore