react-native run-android Building Error':app:generateDebugBuildConfig'

问题描述 投票:9回答:2

我在构建一个新项目时遇到了问题。我正在使用React-Native和Android Emulator(AVD)但是当我使用命令react-native run-android时,我收到以下消息:

FAILURE:构建因异常而失败。

* 什么地方出了错:

任务':app:generateDebugBuildConfig'的执行失败。

> java.io.IOException:无法删除路径'C:\ Users \ diego \ Desktop \ Diego \ albums \ android \ app \ build \ generated \ source \ buildConfig \ debug \ com'。

*尝试:

使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。

建筑失败

总时间:2分钟47.189秒

无法在设备上安装应用程序,请阅读上面的错误以获取详细信息。确保您运行的是Android模拟器或已连接设备并设置了Android开发环境:https://facebook.github.io/react-native/docs/android-setup.html

这是提示的图像:Image of the problem

我怎样才能解决这个问题?

-------------------------------------------------- ----------- UPDATE -------------------------------------- -----------------

我将值C:\....\AppData\Local\Android\sdk\tools添加到变量Path并且我的构建成功了。问题解决了。好极了。

谢谢。

java android react-native build
2个回答
2
投票

@ diego-barreto

将值C:\....\AppData\Local\Android\sdk\tools添加到变量Path,我的构建成功了。问题解决了。好极了。


0
投票

反应原生

在构建反应原生应用程序时面临类似问题。在其他端口上运行作为默认端口(8081)由其他一些应用程序使用。

用于构建应用程序的命令。

react-native run-android --port=8082

解决我的情况

(删除了额外的属性android:screenOrientation="portrait"。如果你检查日志,它说

lineNumber:26; columnNumber:56;绑定到命名空间“http://schemas.android.com/apk/res/android”的属性“screenOrientation”已经为元素“activity”指定。

因此删除了相同的属性。这被多次添加

错误日志

Configure project :react-native-webview
:react-native-webview:reactNativeAndroidRoot /Users/PROJECT_PATH/node_modules/react-native/android

Task :app:generateDebugBuildConfig FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateDebugBuildConfig'.
org.xml.sax.SAXParseException; systemId: file:/Users/PROJECT_PATH/android/app/src/main/AndroidManifest.xml; lineNumber: 26; columnNumber: 56; Attribute "screenOrientation" bound to namespace "http://schemas.android.com/apk/res/android" was already specified for element "activity".

* 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 1s
32 actionable tasks: 1 executed, 31 up-to-date
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

Command failed: ./gradlew installDebug

screenshot of error

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.