gpt4 book ai didi

android - 安装 react-navigation 5 后,应用程序在启动时使用 React Native CLI 崩溃

转载 作者:行者123 更新时间:2023-12-01 07:45:49 24 4
gpt4 key购买 nike

我已经为 react-navigation 安装了所有的包。我已按照 React Navigation 给出的所有说明进行操作.

安装后,当我构建应用程序时,它构建成功但在模拟器上安装后崩溃。我也在我的手机上试过了。但是每次都会崩溃。这是我的项目的截图 Screenshot .

我也发现它只有在我安装时才会崩溃

(#Installing dependencies into a bare React Native project) react 导航的这一部分。

npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view

这是我项目的一些其他代码。

package.json

{
"name": "KhulnaWheels",
"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": {
"@react-native-community/masked-view": "^0.1.6",
"@react-navigation/bottom-tabs": "^5.1.0",
"@react-navigation/drawer": "^5.1.0",
"@react-navigation/material-bottom-tabs": "^5.1.0",
"@react-navigation/material-top-tabs": "^5.1.0",
"@react-navigation/native": "^5.0.8",
"@react-navigation/stack": "^5.1.0",
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-gesture-handler": "^1.6.0",
"react-native-paper": "^3.6.0",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.2.0",
"react-native-tab-view": "^2.13.0"
},
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/runtime": "^7.6.2",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}

android\app\build.gradle(仅限依赖部分)

dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0-rc02'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha03'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules


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

index.js

import 'react-native-gesture-handler';
import {AppRegistry} from 'react-native';

import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

最佳答案

请运行以下命令

cd android && ./gradlew clean && cd ..

关于android - 安装 react-navigation 5 后,应用程序在启动时使用 React Native CLI 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60502404/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com