You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native调试模式下调用API时应用崩溃求助

React Native应用调用API时崩溃问题排查求助

我的React Native(RN)应用调用API时会崩溃,关闭API调用功能后应用可正常运行。崩溃时的错误截图如下:
API调用崩溃错误截图

构建工具版本

buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
ndkVersion = "21.4.7075529"

Gradle依赖配置

dependencies {
    configurations.all { resolutionStrategy.force 'com.squareup.okhttp3:okhttp:4.9.0' }

    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

}

npm包依赖

"dependencies": {
    "@react-native-async-storage/async-storage": "^1.15.11",
    "@react-native-community/datetimepicker": "^3.5.2",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "^9.0.0",
    "@react-native-community/push-notification-ios": "^1.10.1",
    "@react-navigation/bottom-tabs": "^5.11.8",
    "@react-navigation/material-top-tabs": "^5.3.15",
    "@react-navigation/native": "^5.9.3",
    "@react-navigation/stack": "^5.14.3",
    "@reduxjs/toolkit": "^1.6.2",
    "@thecodingmachine/redux-toolkit-wrapper": "^2.0.1",
    "appcenter": "^4.3.0",
    "appcenter-analytics": "^4.3.0",
    "appcenter-crashes": "^4.3.0",
    "axios": "^0.24.0",
    "i": "^0.3.7",
    "i18next": "^21.5.1",
    "jail-monkey": "^2.6.0",
    "moment": "^2.29.1",
    "npm": "^8.1.3",
    "prop-types": "^15.7.2",
    "react": "^17.0.2",
    "react-i18next": "^11.14.2",
    "react-native": "^0.66.5",
    "react-native-code-push": "^7.0.4",
    "react-native-device-info": "^8.4.7",
    "react-native-doc-viewer": "^2.7.8",
    "react-native-document-picker": "^7.1.1",
    "react-native-easy-toast": "^2.0.0",
    "react-native-elements": "^3.4.2",
    "react-native-exception-handler": "^2.10.10",
    "react-native-exit-app": "^1.1.0",
    "react-native-fingerprint-scanner": "^6.0.0",
    "react-native-flipper": "^0.119.0",
    "react-native-fs": "^2.18.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-hyperlink": "^0.0.19",
    "react-native-image-picker": "^4.3.0",
    "react-native-invertible-scroll-view": "^2.0.0",
    "react-native-modal-datetime-picker": "^13.0.0",
    "react-native-pager-view": "^5.4.9",
    "react-native-push-notification": "^8.1.1",
    "react-native-reanimated": "1.13.3",
    "react-native-render-html": "^6.3.0",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-restart": "^0.0.24",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.3.0",
    "react-native-size-matters": "^0.4.0",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-splash-screen": "^3.2.0",
    "react-native-ssl-pinning": "^1.5.4",
    "react-native-svg": "^12.1.1",
    "react-native-tab-view": "^3.1.1",
    "react-native-triangle": "^0.0.9",
    "react-native-vector-icons": "^9.0.0",
    "react-native-webview": "11.17.2",
    "react-redux": "^7.2.6",
    "redux": "^4.1.2",
    "redux-flipper": "^2.0.1",
    "redux-persist": "^6.0.0",
    "unorm": "^1.6.0"
  },

希望各位能提供解决该问题的思路或方法。

内容的提问来源于stack exchange,提问作者mohsinali1317

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 13:20:30