首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >新的依赖关系本机- gradle clean -无法解析所有依赖关系

新的依赖关系本机- gradle clean -无法解析所有依赖关系
EN

Stack Overflow用户
提问于 2017-07-12 06:44:19
回答 1查看 771关注 0票数 1

我最近在我的react-native项目中添加了一个库。在添加此依赖项之前,项目运行良好。但是,当我尝试现在通过react-native run-android运行它时,我得到了这个错误:

代码语言:javascript
复制
File C:\Users\user\.android\repositories.cfg could not be loaded.

FAILURE: Build failed with an exception.

* What went wrong: 
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
   > Could not find com.onesignal:OneSignal:23.0.1.
     Required by:
         project :app
   > Could not find com.onesignal:OneSignal:23.0.1.
     Required by:
         project :app > project :react-native-onesignal

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

BUILD FAILED

Total time: 1 mins 57.711 secs
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/android-setup.html

编辑: android模拟器当然正在运行。在做了一些研究之后,我发现我可以尝试卸载和安装npm,但没有成功。在build.gradle中,我指定了我的onesignal_app_id,以及依赖项下的compile 'com.onesignal:OneSignal:23.0.1'。因此,我尝试了gradle clean,它产生了这个错误:

代码语言:javascript
复制
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':react-native-onesignal'.
      > Failed to notify project evaluation listener.
         > com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V

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

BUILD FAILED in 1s
EN

回答 1

Stack Overflow用户

发布于 2017-08-27 04:08:21

我和Cordova也有类似的问题。

我通过将gradle的版本从2.2.3改为2.3.3进行了修复。

下面是关于这个的一个线条:

代码语言:javascript
复制
sed -i -E 's/com.android.tools.build:gradle:2.2.[0-9]+/com.android.tools.build:gradle:2.3.3/g' build.gradle
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45045619

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档