react-native - 来自调试版本的红屏错误出现在发布版本中
问题描述
我正在通过使用构建我的应用程序的发布版本./gradlew assembleRelease
。获取 api 时,如果发生网络请求失败,则只会出现警告消息,说明Connection error....etc
在以前的应用程序的发布版本中。在调试版本中,会出现红屏错误和警告消息。现在在发布版本中,也会显示红屏错误。
export function GetUserDetail(){
return function(dispatch, getState) {
return AsyncStorage.getItem('loginState')
.then((result) => {
if (result!==null){
var json=JSON.parse(result);
fetch(////domainurl/////, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization' : json.token,
},
body: JSON.stringify({
"params": {
}
})
}).then(e => e.json())
.then(function(response){
console.log(response);
dispatch(getuserdetail(response.result));
}).catch((error) => {
ToastAndroid.show('Connection Error, Please check if you have internet connnection', ToastAndroid.SHORT);
console.error(error,"ERRRRRORRR");
});
}
else{
}
})
}
}
预期:发布版本 - 出现警报消息
实际:发布版本 - 出现警告消息和红屏错误
解决方案
问题解决了,显然公共布尔 getUseDeveloperSupport() 返回 true 而不是返回 BuildConfig.Debug。
推荐阅读
- android - 如何在 Nativescript Angular 中创建类似 CollapsingToolbarLayout 的功能?
- excel - 通过 Angular 调用/运行 VBA 宏
- android - 如何使用 https 不安全证书在 glide 中加载图像
- asp.net - ASP.net (VB.Net) Pageload 上的动态控件并在按钮单击时读取它们的值
- python - 从 statsmodels 中汇总保留变量名称
- android - 跳过 xx 帧 [由 FACEBOOK SDK 引起]
- python - 你应该使用 InfluxDBClient 的 close() 方法吗?
- amazon-web-services - 我应该如何在 Flutter 中集成 Amazon RDS?任何原生飞镖支持包?
- android - 用导航抽屉项目点击替换片段的内容
- php - windows文件系统上不允许的编码和解码字符