简体   繁体   English

react-native 在模拟器中尝试测试时出现应用错误(?)

[英]react-native app error when try and test in emulator(?)

I get this error below whenever I try to test the app after typing the command npx react-native run-android.每当我在输入命令 npx react-native run-android 后尝试测试应用程序时,我都会在下面收到此错误。 I tried setting paths in environmental variables.我尝试在环境变量中设置路径。 But still doesn't work I tried reinstalling react-native but still does not work.但仍然不起作用我尝试重新安装 react-native 但仍然不起作用。 I tried to reinstall JDK from java but finally, the app still does not run in the emulator.我尝试从 java 重新安装 JDK,但最后,该应用程序仍然无法在模拟器中运行。 Any feedback is appreciated:)任何反馈表示赞赏:)

FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。

  • What went wrong: Execution failed for task ':react-native-community_masked-view:compileDebugJavaWithJavac'.出了什么问题:任务“:react-native-community_masked-view:compileDebugJavaWithJavac”执行失败。

Could not find tools.jar.找不到工具。jar。 Please check that C:\Program Files\Java\jre1.8.0_271 contains a valid JDK installation.请检查 C:\Program Files\Java\jre1.8.0_271 是否包含有效的 JDK 安装。

  • Try: Run with --stack trace option to get the stack trace.尝试:使用 --stack trace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.使用 --info 或 --debug 选项运行以获得更多日志 output。 Run with --scan to get full insights.运行 --scan 以获得完整的见解。

  • Get more help at https://help.gradle.orghttps://help.gradle.org获得更多帮助

BUILD FAILED in 21s 21 秒内构建失败

error Failed to install the app.错误 无法安装应用程序。 Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup .确保您已设置 Android 开发环境: https://reactnative.dev/docs/environment-setup Run CLI with --verbose flag for more details.使用 --verbose 标志运行 CLI 以获取更多详细信息。 Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

PS C:\vibenote-texting PS C:\vibenote-texting

I think you need to update your PATH variables.我认为您需要更新 PATH 变量。

To set the PATH variable permanently, add the full path of the jdk1.7.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.7.0\bin. Set the PATH variable as follows on Microsoft Windows:

Click Start, then Control Panel, then System.

Click Advanced, then Environment Variables.

Add the location of the bin folder of the JDK installation for the PATH variable in System Variables. The following is a typical value for the PATH variable:

C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.7.0\bin

From the docs here 从这里的文档

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

相关问题 无法在本机上的模拟器上运行应用 - Can't run app on emulator in react-native react-native run-android 构建错误 ':app:generateDebugBuildConfig' - react-native run-android Building Error ':app:generateDebugBuildConfig' 运行本机Android应用程序时出错-BatchedBridge - Error running a react-native Android app - BatchedBridge 当我尝试在模拟器android studio上运行app时出错 - error when i try to run app on emulator android studio 在运行react-native run-android时发生错误react native - Error react native when run react-native run-android 当我尝试在Android模拟器上运行Junit测试用例时,为什么会发生此错误? - Why does this error occur when I try to run a Junit test-case on the Android emulator? 使用模拟器时 React Native Firebase 崩溃 - React native firebase crashes when using emulator react-native run-android因错误而失败:任务执行失败':app:dexDebug' - react-native run-android failed with error: Execution failed for task ':app:dexDebug' react-native run-android 错误“任务:app:javaPreCompileDebug FAILED” - react-native run-android error "Task :app:javaPreCompileDebug FAILED" React-Native(Android)错误:任务:app:installDebug FAILED(macOs Big Sur) - React-Native (Android) error : Task :app:installDebug FAILED (macOs Big Sur)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM