配置名称'默认'找不到 - React Native

时间:2017-07-17 02:36:12

标签: android react-native react-native-android

当我运行react-native run-android时,我收到以下错误:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > Configuration with name 'default' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

我知道这意味着存在一些链接错误,但我无法弄清楚是什么。我很乐意帮助修复,我对android很新。

2 个答案:

答案 0 :(得分:34)

如果找不到某个软件包依赖项的build.gradle,就会发生这种情况。

要调试此问题,请在您的反应原生项目中运行

cd android
./gradlew clean --info

运行此命令后,您可以看到建筑物停止的位置。转到那个包github页面并搜索问题。你很可能会找到答案。在我的情况下,这是因为react-native-maps,所以我必须修改settings.gradle以指出该包的build.gradle的真实位置

答案 1 :(得分:1)

在使用

的情况下,我也会遇到相同的问题
  

react-native-sms-android

我的解决方案:

  

npm install react-native-sms-android --save

,然后按照文档中所述修改其余文件。