【发布时间】:2021-09-12 11:51:24
【问题描述】:
我正在尝试从我的测试 Android 设备连接到我的 Firebase 函数模拟器。
当我运行模拟器时,输出是:
┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://localhost:4000 │
└─────────────────────────────────────────────────────────────┘
┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├───────────┼────────────────┼─────────────────────────────────┤
│ Functions │ localhost:5001 │ http://localhost:4000/functions │
└───────────┴────────────────┴─────────────────────────────────┘
Emulator Hub running at localhost:4400
Other reserved ports: 4500
Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
在我的 Flutter 应用中,我执行以下操作来连接:
FirebaseFunctions.instance.useFunctionsEmulator(origin: 'http://192.168.1.158:5001');
我已将android:usesCleartextTraffic="true" 添加到我的AndroidManifest 和network_security_config.xml,如here 和here 所述。
我总是收到以下错误:
PlatformException(firebase_functions,com.google.firebase.functions.FirebaseFunctionsException:内部,{代码:不可用,消息:com.google.firebase.functions.FirebaseFunctionsException:内部}
我做错了什么?
【问题讨论】:
-
origin: 'http://localhost:5001'工作吗? -
不@Dharmaraj,这是一个物理设备。
-
那你可以试试
firebase serve --host 0.0.0.0让模拟器在网络上可用吗?
标签: android firebase flutter google-cloud-functions firebase-tools