gpt4 book ai didi

java - 编译到 Android 设备时出现 React Native 全新构建错误

转载 作者:太空宇宙 更新时间:2023-11-04 11:55:11 25 4
gpt4 key购买 nike

我最近使用 react-native init 构建了新的应用程序。

运行react-native run-android后我收到此错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_112\bin\java.exe'' finished with non-zero exit value 1

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

BUILD FAILED

Total time: 19.52 secs
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/android-setup.html

(node:3632) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'message' of undefined
(node:3632) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

我已经尝试在我的 android 文件夹中运行 gradlew clean 但仍然没有成功。

有什么解决办法吗?

最佳答案

有同样的问题,经过大量故障排除后,我发现 android 项目已损坏。以下是我的修复方法:

来自项目文件夹:

  1. rm -rf android
  2. react-native 升级

注意:仅运行react-native升级而不删除android文件夹似乎不起作用。

关于java - 编译到 Android 设备时出现 React Native 全新构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41438529/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com