错误 无法安装应用程序.确保您已设置 Android 开发环境 [英] Error Failed to install the app. Make sure you have the Android development environment set up

查看:52
本文介绍了错误 无法安装应用程序.确保您已设置 Android 开发环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了 react-native 项目,然后在终端打开文件夹;在运行npm start"然后react-native run-android"之后,我能够在虚拟设备上运行它.但是,当我从 vscode 终端执行此操作时,出现以下错误;

I created the react-native project, then open the folder, at the terminal; After running "npm start" and then "react-native run-android" I was able to run it on the virtual device. However, when I do this from the vscode terminal, I get the following error;

info 运行 jetifier 以将库迁移到 AndroidX.您可以使用--no-jetifier"标志禁用它.Jetifier 找到了 863 个要转发 Jetify 的文件.使用 4 个工人...info JS 服务器已经在运行.信息 安装应用程序...错误:无法找到或加载主类 org.gradle.wrapper.GradleWrapperMain引起:java.lang.ClassNotFoundException:org.gradle.wrapper.GradleWrapperMain

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 863 file(s) to forward-jetify. Using 4 workers... info JS server already running. info Installing the app... Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

错误无法安装应用程序.确保您已设置 Android 开发环境:https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment.使用 --verbose 标志运行 CLI 以获取更多详细信息.错误:命令失败:./gradlew app:installDebug -PreactNativeDevServerPort=8081错误:无法找到或加载主类 org.gradle.wrapper.GradleWrapperMain引起:java.lang.ClassNotFoundException:org.gradle.wrapper.GradleWrapperMain

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

at checkExecSyncError (child_process.js:601:13)
at execFileSync (child_process.js:621:13)
at runOnAllDevices (/home/myworldsoftware-u/İndirilenler/project2/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:74:39)
at buildAndRun (/home/myworldsoftware-u/İndirilenler/project2/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/home/myworldsoftware-u/İndirilenler/project2/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

推荐答案

npx react-native doctor

此命令检查您的环境并显示 react-native 安装状态的报告.仔细检查您可能需要安装的其他软件的输出

This command checks your environment and displays a report of the status of react-native installation. Check the output carefully for other software you might need to install

这篇关于错误 无法安装应用程序.确保您已设置 Android 开发环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆