【问题标题】:React Native CLI failed to determine Android project configurationReact Native CLI 无法确定 Android 项目配置
【发布时间】:2020-05-14 11:25:07
【问题描述】:

我正在尝试构建我的 android 项目,但遇到了配置错误。 之前我构建了一个应用程序包,但之后,我收到以下错误。

我已经删除了 node_nodules 并尝试了“yarn install”,但错误仍然存​​在。

    D:\ReactNative\Mapin\android>gradlew assembleRelease
Starting a Gradle Daemon, 10 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* Where:
Script 'D:\ReactNative\Mapin\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 206

* 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:D:\ReactNative\Mapin\android, reactNativePath:D:\ReactNative\Mapin\node_modules\react-native, dependencies:[:], commands:[], assets:[], platforms:[:], haste:[providesModuleNodeModules:[], platforms:[]], project:[:]]

* 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 15s

【问题讨论】:

  • 在我们的例子中,我们有一个非典型的结构,因为我们多年前将 React Native 添加到现有的 Android 应用程序中。在将主应用程序/模块名称更改为 app 并将整个 Android 应用程序移动到 android 子目录后,一切都开始正常工作了。我相信你可以配置一些东西来使非标准结构工作,这是我们以前做的,但是随着自动链接的出现,额外的环跳感觉没有必要了。所以我们屈服于默认设置,现在继续前进。

标签: android reactjs react-native android-studio


【解决方案1】:

修正如下:

yarn add @react-native-community/cli-platform-android@3.0.3
yarn add react-native@0.61.5
Removed "--quiet" from npx.cmd in native_modules.gradle
cd android && gradlew clean

native_modules.gradle 位于:

${PROJECT_FOLDER}/node_modules/@react-native-community/cli-platform-android/native_modules.gradle

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-01
    • 2019-01-16
    • 2022-08-14
    • 1970-01-01
    • 2019-12-03
    相关资源
    最近更新 更多