android - 在 reactNative 中运行模拟器和 gradle 的问题
问题描述
我在模拟器中运行应用程序时遇到问题并给出以下错误:(我在 Genymotion 和 nox 模拟器上测试过)
none
C:\Users\Sajjad Alavi\Desktop\n\test1>npm run android
> @ android C:\Users\Sajjad Alavi\Desktop\n\test1
> react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && gradlew.bat ap
p:installDebug)...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Sajjad Alavi\Desktop\n\test1\android\app\build.gradle' line
: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : U
nsupported major.minor version 52.0
* 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
Deprecated Gradle features were used in this build, making it incompatible with
Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:com
mand_line_warnings
BUILD FAILED in 6s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag
for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ android script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sajjad Alavi\AppData\Roaming\npm-cache\_logs\2019-09-11T16
_13_49_689Z-debug.log
解决方案
你应该去
user >> program_data >> gradle
删除缓存然后,在android studio中运行程序
推荐阅读
- javascript - 单击图像时播放与图像关联的视频
- python - Pandas 数据框:一个系列的真值是模棱两可的。使用 a.empty、a.bool()、a.item()、a.any() 或 a.all()
- javascript - 如何从不需要的键数组中选择对象中的项目并使用结果创建新对象
- mysql - 嵌套或多个 case 函数
- reactjs - 如何在 react-chat-engine 中使用发布请求创建用户?
- python - 由于客户端网络限制,Python Jira 身份验证失败?
- outlook - 如何在 Outlook 中自动执行 PST 导出
- xml - 在 XSD 中,如何显示一个元素只能位于具有特定属性的父级中?
- javascript - 如何从 javascript 中获取价值?
- python - Django:如果提交表单,则为不同的 html 页面