flutter mobile(android 模拟器) http post 无法访问网站
flutter mobile(android emulator) http post doesn't reaches website
我的 http.post 请求在我的手机(android 模拟器)上没有给出任何答案。
在浏览器上,它给出了经典的 XMLHttpRequest 错误,但这不是主题。
final response = await http.post('https://www.notthewebsite.de/420/lalala.php', body: {
"eMail": eMail.text,
"password": password.text,
});
var datauser = json.decode(response.body);
它没有到达网站,因为如果它调用网站,它会在数据库中插入一些东西。
但是当我手动启动网站时,插入数据库是有效的。
感谢任何答案。
您可以在模拟器上通过浏览器(例如Chrome)访问网站吗?
我一直需要使用 -dns 开关启动我的模拟器,否则名称解析会失败:
c:\AndroidSDK\emulator\emulator.exe -avd Android-28-Playstore-x64 -dns-server 8.8.8.8
这对我有帮助(第一个答案,mac 的小提示我不得不在 android studio 的 AVD 管理器中按磁盘上的显示以访问该文件夹,否则我不能找到它):
Emulator: emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature
我的 http.post 请求在我的手机(android 模拟器)上没有给出任何答案。 在浏览器上,它给出了经典的 XMLHttpRequest 错误,但这不是主题。
final response = await http.post('https://www.notthewebsite.de/420/lalala.php', body: {
"eMail": eMail.text,
"password": password.text,
});
var datauser = json.decode(response.body);
它没有到达网站,因为如果它调用网站,它会在数据库中插入一些东西。 但是当我手动启动网站时,插入数据库是有效的。
感谢任何答案。
您可以在模拟器上通过浏览器(例如Chrome)访问网站吗?
我一直需要使用 -dns 开关启动我的模拟器,否则名称解析会失败:
c:\AndroidSDK\emulator\emulator.exe -avd Android-28-Playstore-x64 -dns-server 8.8.8.8
这对我有帮助(第一个答案,mac 的小提示我不得不在 android studio 的 AVD 管理器中按磁盘上的显示以访问该文件夹,否则我不能找到它): Emulator: emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature