10

嗨,我在测试我的 react 本机应用程序时遇到了问题,今天早上它工作正常,但是当我现在测试它时,我得到了这个错误:

Could not resolve all files for configuration ':react-native-vector-icons:classpath'.

找不到 com.android.tools.build:gradle:2.3.+ 的任何匹配项,因为没有可用的 com.android.tools.build:gradle 版本。在以下位置搜索: https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml https://jcenter.bintray.com/com/android/tools/build/gradle / 要求:项目:react-native-vector-icons 任何人都可以帮助我,谢谢

4

6 回答 6

2

嗨,在你的部分android/build.gradle之后试试这个allprojects

    subprojects {
    if (project.name.contains('react-native-vector-icons')) {
        buildscript {
            repositories {
                maven {
                    url "https://dl.bintray.com/android/android-tools/"
                }
                jcenter()
            }
        }
    }
}
于 2018-12-11T13:08:54.893 回答
2

今天我和你有同样的问题!然后我尝试更改版本,现在已修复。只需像这样编辑你的 package.json 。

之前:"react-native-vector-icons": "^5.0.0",

之后:"react-native-vector-icons": "^6.1.0",

于 2018-12-11T12:45:48.603 回答
2

只需安装更新版本的软件包

yarn add react-native-vector-icons

于 2018-12-11T09:00:57.547 回答
0

请分享您当前的以下版本

  1. 反应本机矢量图标
  2. 当前的 gradle 版本

此问题是由于当前您的应用程序正在使用不同的 gradle 版本构建,并且 react-native-vector-icons 需要 gradle 2.3.+

安装旧版本的 react-native-vector-icons 可能会解决此问题。

或者按照这个 =>如何在 android studio 中更新 gradle 来更新你当前的 gradle 版本?

于 2018-12-11T07:55:43.223 回答
0

旧版本的 react-native-vector-icons 似乎引用了最近停止可用的 Android Gradle 插件版本。

更新您的版本应该可以解决问题。您可以按照 react-native-vector-icons安装说明执行此操作:

npm install react-native-vector-icons --save

或者如果你使用纱线:

yarn add react-native-vector-icons
于 2018-12-11T00:29:34.577 回答
0

Node 不擅长判断何时存在已使用包的更新版本。在这种情况下,package.json 文件中引用的 react-native-vector-icons 版本使用的是旧版本的 gradle。

要解决此问题,请先尝试:

npm install react-native-vector-icons -save

如果这不起作用,在我的情况下不起作用,请进入您的package.json文件并自己将包更改为最新版本。

react-native-vector-icons网站获取最新版本(现在是 6.1.0)并更改 中的行package.json,使其成为:

"dependencies": {
    ...

    "react-native-vector-icons": "^6.1.0",

    ...
 }
于 2018-12-11T16:06:09.670 回答