首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解析配置':react-native-image-picker:classpath‘的所有文件

无法解析配置':react-native-image-picker:classpath‘的所有文件
EN

Stack Overflow用户
提问于 2018-12-11 07:31:26
回答 4查看 1.9K关注 0票数 2

我有一周没有接触我的项目,但当我回来在android模拟器上运行项目时,我突然收到了这个错误

代码语言:javascript
复制
* What went wrong:
A problem occurred configuring project ':react-native-image-picker'.
> Could not resolve all files for configuration ':react-native-image-picker:classpath'.
> Could not find any matches for com.android.tools.build:gradle:2.2.+ as no versions of com.android.tools.build:gradle are available.
 Searched in the following locations:
     https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
     https://jcenter.bintray.com/com/android/tools/build/gradle/
 Required by:
     project :react-native-image-picker

我的build.gradle

代码语言:javascript
复制
buildscript {
repositories {
    jcenter()
    google()
    mavenLocal()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    mavenLocal()
    jcenter()
    maven { url "https://jitpack.io" }
    maven { url "https://maven.google.com" }
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
}
}

我已经在stackoverflow上搜索了一段时间,但我没有找到解决方案。任何帮助都是非常感谢的。

EN

回答 4

Stack Overflow用户

发布于 2018-12-11 14:06:25

google()移到jcenter()之上,并对allProjects部分执行此操作也解决了我同样的问题。

票数 1
EN

Stack Overflow用户

发布于 2018-12-11 07:38:25

看看这个答案,它会帮助你解决你的问题:https://stackoverflow.com/a/53692168/3104599

由于链接还不够,我将在这里复制粘贴答案。我知道答案不是我自己的,我只是引用:

这是我的修复,我没有派生repos,只是使用了这个变通方法:将这个添加到您的build.gradle文件中,settings.gradle文件的兄弟文件

子项目{项目->定义名称= project.name if (name.contains(‘模块名称,例如react-native-->’) || name.contains(‘其他模块名称,例如react-native-image-picker')) { buildscript {存储库{ maven {https://dl.bintray.com/android/android-tools/ "https://dl.bintray.com/android/android-tools/“}} }

票数 0
EN

Stack Overflow用户

发布于 2018-12-11 19:14:38

检查这个:https://github.com/react-native-community/react-native-image-picker/issues/999#issuecomment-445465847

我也犯了同样的错误,我用下面的答案纠正了它。

您只需使用与您的android/build.gradle相同的“类路径”来编辑node_modules/react-native-image-picker/android/build.gradle的“类路径”。

我希望这将是有用的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53715262

复制
相关文章

相似问题

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