简体   繁体   English

React Native 和 Android Studio:应用构建失败。 错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

[英]React Native and Android Studio: App Failed to build. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

Hello I am new to React Native.你好,我是 React Native 的新手。 I am trying to use an Android Emulator to run my Android App with React Native in Windows OS.我正在尝试使用 Android 模拟器在 Windows 操作系统中使用 React Native 运行我的 Android 应用程序。 I followed the instructions here https://reactnative.dev/docs/environment-setup but I am getting these errors:我按照https://reactnative.dev/docs/environment-setup此处的说明进行操作,但出现以下错误:

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 8 workers...
info JS server already running.
* daemon not running; starting now at tcp:5037
* daemon started successfully
info Launching emulator...
info Successfully launched emulator.
info Installing the app...

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

This is my gradle properties:这是我的 gradle 属性:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip

My Java JDK version is 15.0.2我的Java JDK版本是15.0.2

I tried changing the gradle properties to an earlier version but it doesn't let me since the minimum is 6.5version.我尝试将 gradle 属性更改为较早的版本,但由于最低版本为 6.5 版本,因此我没有这样做。

Can anybody help me please?有人可以帮我吗?

cmd: cmd:

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

if not sucess try start as npx react-native start --reset-cache如果不成功,请尝试以 npx react-native start --reset-cache 开头

if using expo: expo start r -c如果使用 expo: expo 开始 r -c

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

相关问题 命令失败:gradlew.bat installDebug - Command failed: gradlew.bat installDebug NativeScript Android Build引发错误:命令gradlew.bat失败,退出代码为1 - NativeScript Android Build throws error: Command gradlew.bat failed with exit code 1 React-Native(Android)错误:任务:app:installDebug FAILED(macOs Big Sur) - React-Native (Android) error : Task :app:installDebug FAILED (macOs Big Sur) gradlew.bat在android studio中无效的目录 - gradlew.bat invalid directory in android studio Android Studio 项目构建 Output 错误:任务:应用程序:合并调试资源失败 - Android Studio Project Build Output Error: Task :app:mergeDebugResources FAILED 反应本机构建失败任务':app:checkDebugDuplicateClasses'的执行失败 - React native build failed Execution failed for task ':app:checkDebugDuplicateClasses' 构建失败:app:processDebugResources 使用 Android Studio - Build Failed : app:processDebugResources using Android Studio 外部原生构建问题,构建命令失败,Android Studio - exteranl native build issues,build command failed, android studio Android Studio Build失败,异常执行失败':app:dexDebug' - Android Studio Build failed with an exception Execution failed for task ':app:dexDebug' react-native run-android因错误而失败:任务执行失败':app:dexDebug' - react-native run-android failed with error: Execution failed for task ':app:dexDebug'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM