Unable to build Android using "expo run:android"

未关闭
#908 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
javascript, react-native
领域
mobile

调研方向

首先,在使用 create-react-native-app 创建的新项目中复现 expo run:android,然后检查第 256 行的 node_modules/@react-native-community/cli-platform-android/native_modules.gradle 以及生成的 android 项目。将失败的项目与一个能够成功构建的旧项目进行比较,并使用控制台配置输出确定 Android 项目之间的差异。新创建的项目能够使用该命令成功构建即表示完成。

由索引模型根据 Issue 内容生成。

描述

All recent projects created by "create-react-native-app" are not working with the command "expo run:android".

Old projects that I created before (just 1-2 weeks ago) work well with the same command.

Is there any recent updates or changes related to this?

Error messages are attached below.
This project is a new, bare "create-react-native-app" project that I haven't made any change.

[Error Message on Console]

› Building app...
Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

  • Where:
    Script 'C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 256

  • What went wrong:
    A problem occurred evaluating script.

React Native CLI failed to determine Android project configuration. This is likely due to misconfiguration. Config output:
[root:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022, reactNativePath:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\node_modules\react-native, dependencies:[expo:[root:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\node_modules\expo, name:expo, platforms:[ios:[sourceDir:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\node_modules\expo\ios, folder:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\node_modules\expo, pbxprojPath:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\node_modules\expo\ios\Expo.xcodeproj\project.pbxproj, podfile:null, podspecPath:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\node_modules\expo\ios\Expo.podspec, projectPath:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\node_modules\expo\ios\Expo.xcodeproj, projectName:Expo.xcodeproj, libraryFolder:Libraries, sharedLibraries:[], plist:[], scriptPhases:[], configurations:[]], android:null], assets:[], hooks:[:], params:[]]], commands:[[name:log-ios, description:starts iOS device syslog tail], [name:run-ios, description:builds your app and starts it on iOS simulator, examples:[[desc:Run on a different simulator, e.g. iPhone SE (2nd generation), cmd:react-native run-ios --simulator "iPhone SE (2nd generation)"], [desc:Pass a non-standard location of iOS directory, cmd:react-native run-ios --project-path "./app/ios"], [desc:Run on a connected device, e.g. Max's iPhone, cmd:react-native run-ios --device "Max's iPhone"], [desc:Run on the AppleTV simulator, cmd:react-native run-ios --simulator "Apple TV" --scheme "helloworld-tvOS"]], options:[[name:--simulator , description:Explicitly set simulator to use. Optionally include iOS version between parenthesis at the end to match an exact version: "iPhone 6 (10.0)", default:iPhone 13], [name:--configuration , description:Explicitly set the scheme configuration to use, default:Debug], [name:--scheme , description:Explicitly set Xcode scheme to use], [name:--project-path , description:Path relative to project root where the Xcode project (.xcodeproj) lives., default:ios], [name:--device [string], description:Explicitly set device to use by name. The value is not required if you have a single device connected.], [name:--udid , description:Explicitly set device to use by udid], [name:--no-packager, description:Do not launch packager while building], [name:--verbose, description:Do not use xcbeautify or xcpretty even if installed], [name:--port , default:8081], [name:--terminal , description:Launches the Metro Bundler in a new window using the specified terminal path.]]], [name:log-android, description:starts logkitty], [name:run-android, description:builds your app and starts it on a connected Android emulator or device, options:[[name:--root , description:[DEPRECATED - root is discovered automatically] Override the root directory for the android build (which contains the android directory), default:], [name:--variant , description:Specify your app's build variant, default:debug], [name:--appFolder , description:[DEPRECATED ?? use "project.android.appName" in react-native.config.js] Specify a different application folder name for the android source. If not, we assume is "app"], [name:--appId , description:Specify an applicationId to launch after build. If not specified, package from AndroidManifest.xml will be used., default:], [name:--appIdSuffix , description:Specify an applicationIdSuffix to launch after build., default:], [name:--main-activity , description:Name of the activity to start, default:MainActivity], [name:--deviceId , description:builds your app and starts it on a specific device/simulator with the given device id (listed by running "adb devices" on the command line).], [name:--no-packager, description:Do not launch packager while building], [name:--port , default:8081], [name:--terminal , description:Launches the Metro Bundler in a new window using the specified terminal path.], [name:--tasks , description:Run custom Gradle tasks. By default it's "installDebug"], [name:--no-jetifier, description:Do not run "jetifier" ?? the AndroidX transition tool. By default it runs before Gradle to ease working with libraries that don't support AndroidX yet. See more at: https://www.npmjs.com/package/jetifier.], [name:--active-arch-only, description:Build native libraries only for the current device architecture for debug builds., default:false]]]], assets:[], healthChecks:[], platforms:[ios:[:], android:[:]], project:[ios:[sourceDir:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\ios, folder:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022, pbxprojPath:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\ios\reactnativepersonalapp2022.xcodeproj\project.pbxproj, podfile:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\ios\Podfile, podspecPath:null, projectPath:C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\ios\reactnativepersonalapp2022.xcodeproj, projectName:reactnativepersonalapp2022.xcodeproj, libraryFolder:Libraries, sharedLibraries:[], plist:[], scriptPhases:[]], android:null]]

  • 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.

BUILD FAILED in 30s
C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\android\gradlew.bat exited with non-zero code: 1
Error: C:\Visual Studio Code\Tutorial_React Native Master\reactnative_personal_app_2022\android\gradlew.bat exited with non-zero code: 1
at ChildProcess.completionListener (C:\Users\withe\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\spawn-async\src\spawnAsync.ts:65:13)
at Object.onceWrapper (node:events:642:26)
at ChildProcess.emit (node:events:527:28)
at ChildProcess.cp.emit (C:\Users\withe\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
...
at spawnAsync (C:\Users\withe\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\spawn-async\src\spawnAsync.ts:26:19)
at spawnGradleAsync (C:\Users\withe\AppData\Roaming\npm\node_modules\expo-cli\src\commands\run\android\spawnGradleAsync.ts:83:18)
at assembleAsync (C:\Users\withe\AppData\Roaming\npm\node_modules\expo-cli\src\commands\run\android\spawnGradleAsync.ts:57:16)
at actionAsync (C:\Users\withe\AppData\Roaming\npm\node_modules\expo-cli\src\commands\run\android\runAndroid.ts:143:9)

主要语言
JavaScript
星标
13.2k
派生
1.3k
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

expo/create-react-native-app 的其他 Issue

查看 expo/create-react-native-app 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。