Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.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 使用Expo CLI进行本机响应时出现网络错误_Android_React Native_Axios_Fetch_Expo - Fatal编程技术网

Android 使用Expo CLI进行本机响应时出现网络错误

Android 使用Expo CLI进行本机响应时出现网络错误,android,react-native,axios,fetch,expo,Android,React Native,Axios,Fetch,Expo,每当我尝试使用Axios或fetch向API发出请求时,都会出现以下错误。我正在使用expo 40.0.0和react native SDK 40.0.0。一切都很完美,我检查了三遍。每当我试图通过PostMan进行测试时,API都会给我响应。当我在Android上测试EXPO时,我认为Android原生代码有问题。请帮帮我,我什么都试过了,我是个新手。我试图向外部API和我自己的API(在我的机器上运行)发出请求,但得到了相同的错误 Request failed with status co

每当我尝试使用Axios或fetch向API发出请求时,都会出现以下错误。我正在使用expo 40.0.0和react native SDK 40.0.0。一切都很完美,我检查了三遍。每当我试图通过PostMan进行测试时,API都会给我响应。当我在Android上测试EXPO时,我认为Android原生代码有问题。请帮帮我,我什么都试过了,我是个新手。我试图向外部API和我自己的API(在我的机器上运行)发出请求,但得到了相同的错误


Request failed with status code 400
at node_modules\axios\lib\core\createError.js:15:17 in createError
at node_modules\axios\lib\core\settle.js:16:9 in settle
at node_modules\axios\lib\adapters\xhr.js:53:6 in handleLoad
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent      
at node_modules\react-native\Libraries\Network\XMLHttpRequest.js:592:4 in setReadyState
at node_modules\react-native\Libraries\Network\XMLHttpRequest.js:395:6 in __didCompleteResponse
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue   
at [native code]:null in callFunctionReturnFlushedQueue

我们可以看一下你取回的代码吗?
const apiSearch=async()=>{try{const res=wait yelp.get('/status',{params:{limit:50,search,location:'san jose'})console.log(res)}catch(e){console.log(e)}
fetch/Axios没有问题。我将网络调用放入一个单独的文件中,然后通过节点运行该文件,对其进行了测试。它工作得很好,但当我通过android调用它时,它会抛出一个错误。只要我猜错误的最后一行是本机代码出错的地方。@docmurloc非常感谢兄弟,我的基本url有一个错误,这是一个输入错误。只需花3天时间。我真是个笨蛋-(