首页 > 解决方案 > fetch SyntaxError: Unexpected token U in JSON at position 0 in react native Android

问题描述

我正在将 fetch 用于“https” GET 请求,它在 IOS 中运行良好,但在 android中的位置 0 处抛出SyntaxError: Unexpected token U in JSON at position 0错误。当我检查状态它是“状态 401”时,我什至检查了我的域的等级它的“A”等级。

这是我的 build.gradle

buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"

我的反应和反应本机版本如下

"react": "16.9.0",
"react-native": "0.61.4"

我什至尝试在我的 AndroidManifes.xml 文件中添加以下代码。

android:usesCleartextTraffic="true" tools:targetApi="28"

我尝试了一切,但我不知道是什么问题,请帮助谢谢。

标签: androidreact-nativefetch

解决方案


推荐阅读