错误:执行任务'app:generateDebugBuildConfig'失败
java.io.FileNotFoundException: C:\Users\bok\Desktop\Zipzap\app\build\generated\source\buildConfig\debug\com\storie\myapp \BuildConfig.java(指定的路径未找到)
解决方案是什么?
我希望能找到解决这个问题的方法。
尝试清理项目,这对我有效
适用于安卓
$ cd android
$ ./gradlew clean
BUILD SUCCESSFUL in 5s
1 actionable task: 1 executed
更改端口对我有用
你可以尝试:
react-native run-android --port=8082
cd android
.\gradlew clean
(./gradlew clean
对我来说无法工作,原因不明。)cd ..
npx react-native run-android
React Native
在构建React Native应用程序时,遇到了类似的问题。默认端口(8081)被其他应用程序使用,因此需要在不同的端口上运行。
构建应用程序的命令。
react-native run-android --port=8082
解决方案
删除了额外的属性android:screenOrientation="portrait"
。如果您检查日志,它会说:
lineNumber: 26; columnNumber: 56; Attribute "screenOrientation" bound to namespace "http://schemas.android.com/apk/res/android" was already specified for element "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
在Android Studio中,
build
clean project
并等待项目清理完成build
-> rebuild project
并等待项目重建完成。
./gradelew clean
时,出现了 `'.' 不是内部或外部命令的错误提示。 - pratteek shauryaCtrl
+Enter
在 Android Studio 终端中运行命令 - Asef Hossini