我已经浏览了通常的答案。我在 iOS 上编辑了 info.plist,并在 Android 中添加了 network_config.xml。当从 XCode 运行项目时,这非常有效,但是当尝试从 Android Studio 运行调试时,我得到了
Cleartext HTTP traffic to 192.168.1.54 not permitted
Run Code Online (Sandbox Code Playgroud)
似乎 Flutter 在此事上忽略了我的 iOS 和 Android 配置,但仅限于直接从 Android Studio 运行它时。
在使用本地 Firebase 函数模拟器作为我的后端设置我的项目,并从我的 Android 模拟器调用我的 Firebase onCall 函数后,我收到了这条非常无信息的错误消息PlatformException(functionsError, Cloud function failed with exception., {code: INTERNAL, details: null, message: INTERNAL})。完整的错误信息如下:
E/flutter (20862): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(functionsError, Cloud function failed with exception., {code: INTERNAL, details: null, message: INTERNAL})
E/flutter (21445): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (21445): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
E/flutter (21445): <asynchronous suspension>
E/flutter (21445): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
E/flutter (21445): #3 MethodChannelCloudFunctions.callCloudFunction (package:cloud_functions_platform_interface/src/method_channel_cloud_functions.dart:43:15)
E/flutter (21445): #4 HttpsCallable.call (package:cloud_functions/src/https_callable.dart:33:12)
E/flutter (21445): #5 ApiService.loadUserLessonsByLessonIds (package:kim/services/api.dart:28:21)
E/flutter (21445): #6 MapScreen.build.<anonymous closure> (package:kim/screens/map.dart:170:34)
E/flutter (21445): …Run Code Online (Sandbox Code Playgroud) android firebase flutter google-cloud-functions firebase-cli