简体   繁体   English

无法启动新的 React Native 项目

[英]Cant Start a new React Native project

I want to build a new App without Expo and without Yarn.我想构建一个没有 Expo 且没有 Yarn 的新应用程序。

So I launched a new Projekt with react-native init and navigated inside the folder starting the Metro Server (works fine) - but when I want to start the android App on my emulator (AS Emulator) I get this Error:因此,我启动了一个带有 react-native init 的新 Projekt,并在启动 Metro Server 的文件夹内导航(工作正常) - 但是当我想在我的模拟器(AS Emulator)上启动 android 应用程序时,我收到此错误:

    PS C:\Dev\Programmierung\FitnessApp\FitnessApp> npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 6 workers...
info JS server already running.
Der Befehl "adb" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...

> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.

> Task :app:installDebug
01:14:59 V/ddms: execute: running am get-config
01:15:00 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -1
01:15:00 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Nexus_5X_API_29_x86(AVD) - 10' for app:debug
01:15:00 D/app-debug.apk: Uploading app-debug.apk onto device 'emulator-5554'  
01:15:00 D/Device: Uploading file onto device 'emulator-5554'
01:15:00 D/ddms: Reading file permision of C:\Dev\Programmierung\FitnessApp\FitnessApp\android\app\build\outputs\apk\debug\app-debug.apk as: rwx------
01:15:00 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
01:15:00 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
01:15:00 V/ddms: execute: returning
01:15:00 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
01:15:00 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
01:15:00 V/ddms: execute: returning
Installed on 1 device.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 4s
27 actionable tasks: 2 executed, 25 up-to-date
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
info Starting the app...
Der Befehl "adb" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
error Failed to start the app. Run CLI with --verbose flag for more details.
Error: Command failed: adb shell am start -n com.fitnessapp/com.fitnessapp.MainActivity
    at makeError (C:\Dev\Programmierung\FitnessApp\FitnessApp\node_modules\execa\index.js:174:9)
    at Function.module.exports.sync (C:\Dev\Programmierung\FitnessApp\FitnessApp\node_modules\execa\index.js:338:15)
    at tryLaunchAppOnDevice (C:\Dev\Programmierung\FitnessApp\FitnessApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\tryLaunchAppOnDevice.js:57:22)
    at C:\Dev\Programmierung\FitnessApp\FitnessApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:104:39   
    at Array.forEach (<anonymous>)
    at runOnAllDevices (C:\Dev\Programmierung\FitnessApp\FitnessApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:102:48)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at async Command.handleAction (C:\Dev\Programmierung\FitnessApp\FitnessApp\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:186:9)

I already tried to fix it but with no luck.我已经尝试修复它但没有运气。

Before this error I had this Error:在这个错误之前我有这个错误:

Task 'installDebug' not found in project ':app'.

My Project Android Folder is selected in AS and the Emulator is running.我的项目 Android 文件夹在 AS 中被选中,Emulator 正在运行。

I got this error every time.我每次都收到这个错误。

Follow this steps to get rid of it:请按照以下步骤摆脱它:

1) Open Android Studio. 1) 打开 Android 工作室。

2) Open your android folder of react native project in android studio. 2) 在 android 工作室中打开你的 android 文件夹中的 React Native 项目。

Now it'll start downloading all the necessary files现在它将开始下载所有必要的文件

3) Click on run button. 3) 单击运行按钮。

Now once application gets installed in your android device you can use react-native-run-android现在,一旦应用程序安装在您的 android 设备中,您就可以使用react-native-run-android

take the terminal goto your project folder using cd command and type npx jetify.使用 cd 命令将终端转到您的项目文件夹并键入 npx jetify。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM