简体   繁体   中英

React Native Android Development - Execution failed for task ':app:compileDebugJavaWithJavac' on Windows Webstorm

I have an issue with installing and running the React-Native Android guide to create AwesomeProject . I am using a Windows 10 environment with Webstorm as my IDE. When ever I run the following command, the emulator fails to launch:

react-native run-android

Here is a screen cap of the Web Storm: 在此处输入图片说明

I have all the SDK and JDK configured in my System Environments, this is why I don't the error. Here are the additional steps I took configuring Gradle plugin: 在此处输入图片说明

I have googled the issue but the solutions I found were for MacOS users and didn't translate for Windows.

Has anyone come across this issue on Windows and fixed it?

I fixed the issue by installing JDK 8 as listed in the React Native guide. Then updated both the Environment Variables and the gradle.properties file.

I ONLY GOT IT TO WORK IN ANDROID STUDIO

环境变量

gradle.properties 文件

This seems to have worked for me. But now I got a new error to fix, which basically is that application isn't detecting a device or emulation.

任务 ':app:installDebug' 执行失败

However, to get around that, I have to ensure that I open the AVD Manager and run one of the configured virtual devices prior to executing the command npx react-native run-android .

This does annoy me having to perform that task first. If anyone knows how to get it to automatically run a default virtual device, that would be nice.

成功执行Awesome Project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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