gpt4 book ai didi

android - 模块 react-native-fs 和 rn-fetch-blob 的 React Native 构建失败

转载 作者:行者123 更新时间:2023-11-29 16:36:19 25 4
gpt4 key购买 nike

当我运行 npm run android 时遇到构建失败(在 macOS for Android 上)并且出现以下构建失败:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve project :react-native-fs.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-fs: None of the consumable configurations have attributes.
> Could not resolve project :rn-fetch-blob.
Required by:
project :app
> Unable to find a matching configuration of project :rn-fetch-blob: None of the consumable configurations have attributes.

显然,在 node_modules/react-native-fs/androidnode_modules/rn-fetch-blob/android 中,我只看到一个 IML 文件,没有特定模块代码。我忘记正确下载了吗?我的 android/settings.gradle 文件如下:

rootProject.name = 'FooApp'
include ':react-native-version-number'
project(':react-native-version-number').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-version-number/android')
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
include ':rn-fetch-blob'
project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android')
include ':react-native-google-signin'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-signin/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')

include ':app'

我是否漏掉了一些明显的东西?

最佳答案

您可以尝试删除文件夹node_modules并重新安装

rm -rf node_modules
npm install
react-native link

之后通过 cd android && gradle clean 清理 android并再次运行 android

关于android - 模块 react-native-fs 和 rn-fetch-blob 的 React Native 构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52312559/

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