在 React-Native 中激活调试时卡在黑屏上

Stuck on black screen when activating debug in React-Native

我的 android 设备中的 RN 应用程序有问题(尚未在 iOS 上测试),一旦我在设备上激活调试,它就会卡在黑色屏幕上屏幕.

我不知道代码的哪一部分或什么设置导致了这个,这就是我没有在这里显示任何代码的原因。只是想看看你们以前有没有遇到过同样的问题。

这是我尝试过的:

 gradlew clean 
 react-native start --reset-cache
 cleaned app data and cache in the device
 uninstalled the app from the device

以下是我目前在我的应用程序上安装和使用的软件包:

{
  "name": "bleconnect",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@ant-design/icons": "^4.7.0",
    "@react-native-async-storage/async-storage": "^1.15.14",
    "@react-native-community/blur": "^3.6.0",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-firebase/app": "^14.7.0",
    "@react-native-firebase/auth": "^14.2.1",
    "@react-native-firebase/firestore": "^12.4.0",
    "@react-native-firebase/functions": "^14.2.1",
    "@react-native-firebase/storage": "^14.7.0",
    "@react-navigation/drawer": "^6.3.1",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/stack": "^6.0.11",
    "evil-icons": "^1.10.1",
    "geofirestore": "^4.4.2",
    "haversine": "^1.1.1",
    "node": "^16.13.1",
    "npm-check-updates": "^12.4.0",
    "react": "17.0.1",
    "react-chat-elements": "^11.0.1",
    "react-content-loader": "^6.2.0",
    "react-native": "0.64.2",
    "react-native-animated-spinkit": "^1.5.2",
    "react-native-countdown-circle-timer": "^3.0.6",
    "react-native-device-info": "^8.1.5",
    "react-native-elements": "^3.4.2",
    "react-native-fast-image": "^8.5.11",
    "react-native-gesture-handler": "^2.1.0",
    "react-native-grid-image-viewer": "^1.3.0",
    "react-native-image-crop-picker": "^0.37.3",
    "react-native-image-picker": "^4.7.3",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-location": "^2.5.0",
    "react-native-permissions": "^3.3.1",
    "react-native-reanimated": "^2.8.0",
    "react-native-reanimated-carousel": "^2.4.0",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.10.2",
    "react-native-svg": "^12.3.0",
    "react-native-vector-icons": "^8.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.64.0",
    "react-test-renderer": "17.0.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

我会尝试 npm 卸载所有软件包并重新安装最新版本,但我正在使用某些库的特定版本,所以我无法将所有内容更新到最新版本。

尝试使用 android studio 运行 你的项目,我认为它有错误会显示在这里。

我找到了解决方法。我强制将 react-native-reanimated 包降级到 2.2.4,现在调试器工作正常。

npm i react-native-reanimated@2.2.4 --force

如果不使用--force命令,可能会降级失败。