首页 > 解决方案 > 来自调试版本的红屏错误出现在发布版本中

问题描述

我正在通过使用构建我的应用程序的发布版本./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{

        }
      })
    }
}

预期:发布版本 - 出现警报消息

实际:发布版本 - 出现警告消息和红屏错误

标签: react-native

解决方案


问题解决了,显然公共布尔 getUseDeveloperSupport() 返回 true 而不是返回 BuildConfig.Debug。


推荐阅读