Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 网络请求失败_Android_React Native_Fetch - Fatal编程技术网

Android 网络请求失败

Android 网络请求失败,android,react-native,fetch,Android,React Native,Fetch,我对fetch()api有问题,我使用get方法+https,在Android 9中不起作用。在安卓系统中,7起作用 代码: fetch('https://facebook.github.io/react-native/movies.json') .然后(功能(响应){ 返回response.json(); }) .then(函数(myJson){ 警报(JSON.stringify(myJson)); }) .catch(函数(错误){ 警报(错误); }); 屏幕: 启动android 9

我对fetch()api有问题,我使用get方法+https,在Android 9中不起作用。在安卓系统中,7起作用

代码:

fetch('https://facebook.github.io/react-native/movies.json')
.然后(功能(响应){
返回response.json();
})
.then(函数(myJson){
警报(JSON.stringify(myJson));
})
.catch(函数(错误){
警报(错误);
});
屏幕:

启动android 9时,您必须手动声明您的应用程序可以向哪个url发出请求

如果您希望快速修复并打开所有url的应用程序,只需在您的清单中添加:

 <application
        android:usesCleartextTraffic="true"
        ...
     >

什么都没有改变。我不是说你原来的错误是什么?您在错误响应中看到了什么?您是否厌倦了我的解决方案?成功了吗?