有人可以帮我吗?我尝试使用 Flutter 构建一个基于 Google Firebase Auth 和 Cloud Firestore 的 Web 应用程序。Android 上的项目运行良好,我可以与用户合作并可以从我的 Cloud Firestore 数据库中获取数据。我制作了第二个应用程序 (webapp) 执行 Firebase 文档中描述的所有步骤(webapp 已注册,托管在 Firebase 上),在 pubspec.yaml 中插入所有依赖项
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
firebase_core: ^0.4.4+3
firebase: ^7.3.0
firebase_auth: ^0.16.0
Run Code Online (Sandbox Code Playgroud)
像这样修改了 index.html:
<body>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="/__/firebase/7.14.3/firebase-app.js"></script>
<!-- TODO: …Run Code Online (Sandbox Code Playgroud) 我尝试从我的 Flutter/Android 项目调用 Intent 请求。\n如上所述,应该按如下方式完成
\nIntent intent = \xe2\x80\x8bnew \xe2\x80\x8bIntent();\nintent.setComponent(\xe2\x80\x8bnew \xe2\x80\x8bComponentName(\xe2\x80\x8b"sk.co.xxx.yyy"\xe2\x80\x8b, "sk.co.xxx.yyy.MainActivity"\xe2\x80\x8b));\nJSONObject jReq = \xe2\x80\x8bnew \xe2\x80\x8bJSONObject();\nString sReq=\xe2\x80\x8b""\xe2\x80\x8b;\njReq.put(\xe2\x80\x8b"Amount"\xe2\x80\x8b,\xe2\x80\x8b<Amount>\xe2\x80\x8b); \njReq.put(\xe2\x80\x8b"Operation"\xe2\x80\x8b,\xe2\x80\x8b<Operation>\xe2\x80\x8b);\njReq.put(\xe2\x80\x8b"TransactionID"\xe2\x80\x8b,<can be generated e.g.getRandom()>); \nsReq = jReq.toString();\n\nif\xe2\x80\x8b(sReq.isEmpty())\xe2\x80\x8breturn\xe2\x80\x8b; \nintent.putExtra(\xe2\x80\x8b"POS_EMULATOR_EXTRA"\xe2\x80\x8b, sReq); try \xe2\x80\x8b{\nstartActivityForResult(intent, \xe2\x80\x8b<requestCode>\xe2\x80\x8b); }\nRun Code Online (Sandbox Code Playgroud)\n如何在 Flutter 下实现此代码?\n我尝试使用 flutter.dev 中的 android_intent 包,但收到以下错误消息:
\nE/MethodChannel#plugins.flutter.io/android_intent(22815): Failed to handle method call\nE/MethodChannel#plugins.flutter.io/android_intent(22815): android.content.ActivityNotFoundException: No Activity found to handle Intent \nRun Code Online (Sandbox Code Playgroud)\n感谢您的任何答复!
\n我的 Flutter 代码替换上面的代码是:
\nif (Platform.isAndroid) {\n Map data = {\n "Amount": "$amount",\n "Operation": "$operation"\n };\n AndroidIntent intent = AndroidIntent(\n componentName: "sk.co.xxx.yyy"\xe2\x80\x8b,\n data: …Run Code Online (Sandbox Code Playgroud) 我有这个错误,被 Crashlytics、Flutter、iOS 捕获:崩溃:io.flutter.1.io SIGABRT ABORT 0x00000001b624d414
完整的错误文本是:
Crashed: io.flutter.1.io
0 libsystem_kernel.dylib 0x1b624d414 __pthread_kill + 8
1 libsystem_pthread.dylib 0x1d3da8b50 pthread_kill + 272
2 libsystem_c.dylib 0x19172bb74 abort + 104
3 Metal 0x19eb219d4 MTLGetWarningMode + 218
4 IOGPU 0x1c5828490 -[IOGPUMetalCommandBuffer pushDebugGroup:] + 242
5 Metal 0x19eb11990 -[_MTLCommandEncoder initWithCommandBuffer:] + 884
6 IOGPU 0x1c582a140 -[IOGPUMetalCommandEncoder initWithCommandBuffer:] + 56
7 AGXMetalA13 0x1d54462b4 (Missing)
8 AGXMetalA13 0x1d5189770 (Missing)
9 Flutter 0x101c39b00 (Missing)
10 Flutter 0x101c3c9bc (Missing)
11 Flutter 0x101b42d84 (Missing)
12 Flutter 0x101b5596c (Missing)
13 Flutter …Run Code Online (Sandbox Code Playgroud)