firebase - 将 Xamarin 表单链接到 Firestore
问题描述
我在将 Xamarin Forms 链接到 Firestore 时遇到问题。我在 Firebase 的 Firestore 数据库中有一个名为 Candidates 的集合,我正在使用 Plugin.CloudFirestore nuget 来链接 Firestore 和 Xamarin Forms
我尝试在以下链接中使用“获取”示例:
https://github.com/f-miyu/Plugin.CloudFirestore
var query = await CrossCloudFirestore.Current
.Instance
.GetCollection("Candidates")
.GetDocumentsAsync();
var documents = query.ToObjects<Candidate>();
当我运行代码时,我收到以下消息
“未处理的异常:Java.Lang.IllegalStateException:名称为 [FirebasePlugin] 的 FirebaseApp 不存在。”
关于出了什么问题的任何想法?
解决方案
您是否按照说明进行操作?
- 将 google-services.json 添加到 Android 项目。选择 GoogleServicesJson 作为构建操作。(如果无法选择 GoogleServicesJson,请重新加载此 android 项目。)
目标框架必须是 Android 9.0 (Pie)。如果您使用其他库、Xamarin.Forms 等,则需要启用 Multi-Dex。
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion> <AndroidEnableMultiDex>true</AndroidEnableMultiDex>
推荐阅读
- aws-codebuild - 在 codebuild 中运行并行构建
- spring-boot - 无法使用 intellij 运行 Spring Boot 应用程序,但能够从终端和 jar 文件运行应用程序
- laravel - 如何在 laravel API 中应用分页?
- c - 如何在C中定义一个负数
- python - 如何比较列表的所有元素
- javascript - 无法通过 Chrome 或 Edge 为日语环境打开本地文件
- html - 如何使用 ansible 和 jinja2 为多个主机生成 html 报告
- laravel - 如何将变量从插槽传递到 Laravel 中的布局?
- mysql - 如何使用 FastAPI 后端防止 Cloud Armor WAF SQL 注入提示?
- google-apps-script - In GAS, how can ‘instanceof’ be used for Spreadsheet?