4

该应用程序在安装 React-native-Reanimated 库之前运行良好,但在尝试远程调试时开始崩溃。除非重新安装并显示此错误,否则它甚至不会重新启动:

尝试在空对象引用上调用接口方法“java.lang.String com.facebook.react.bridge.CatalystInstance.getSourceURL()”

错误信息

该应用程序没有启动,但按照 React Reanimated 文档中的安装说明使其工作,但现在每次我尝试连接到远程调试器时它都会崩溃。

 "dependencies": {
    "@react-native-community/cli": "^6.3.0",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-navigation/native": "^5.9.8",
    "@react-navigation/stack": "^5.14.9",
    "@reduxjs/toolkit": "^1.6.2",
    "axios": "^0.24.0",
    "react": "17.0.2",
    "react-native": "0.66.3",
    "react-native-eject": "^0.1.2",
    "react-native-gesture-handler": "^2.1.0",
    "react-native-image-pan-zoom": "^2.1.12",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-reanimated": "^2.3.0",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.10.1",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-vector-icons": "^9.0.0",
    "react-redux": "^7.2.6"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "@types/jest": "^26.0.23",
    "@types/react-native": "^0.66.4",
    "@types/react-native-vector-icons": "^6.4.10",
    "@types/react-test-renderer": "^17.0.1",
    "babel-jest": "^26.6.3",
    "eslint": "^7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-test-renderer": "17.0.2",
    "typescript": "^4.4.4"
  },
4

2 回答 2

1

在他们的文档中提到,react-native-reanimated 不再可以进行远程调试。

由于库使用 JSI 进行同步本地方法访问,因此不再可能进行远程调试。您可以使用 Flipper 来调试 JS 代码,但是目前不支持将调试器连接到运行在 UI 线程上的 JS 上下文。

ref : React Native Reanimated 已知问题和限制

要使用 Flipper,请参阅此文档:使用 Flipper调试 React Native 应用程序

于 2022-01-13T08:28:59.183 回答
0

好的,所以在安装 reanimated 2 后似乎无法进行远程调试,而是使用 Flipper 进行调试

于 2022-01-13T06:25:58.660 回答