找不到 com.android.tools.build:gradle:2.3.+ 的任何匹配项,因为没有可用的 com.android.tools.build:gradle 版本

Could not find any matches for com.android.tools.build:gradle:2.3.+ as no versions of com.android.tools.build:gradle are available

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

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

Could not find any matches for com.android.tools.build:gradle:2.3.+ 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-vector-icons could anyone helps me and thanks

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

更新您的版本应该可以解决问题。您可以根据 react-native-vector-icons installation instructions 执行此操作:

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

或者如果你使用纱线:

yarn add react-native-vector-icons

请分享您当前关注的版本

  1. react-native-vector-icons
  2. 当前gradle版本

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

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

或按照此操作更新您当前的 gradle 版本 => How to update gradle in android studio?

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

yarn add react-native-vector-icons

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

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

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

您好,在 allprojects 部分

之后的 android/build.gradle 试试这个
    subprojects {
    if (project.name.contains('react-native-vector-icons')) {
        buildscript {
            repositories {
                maven {
                    url "https://dl.bintray.com/android/android-tools/"
                }
                jcenter()
            }
        }
    }
}

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",

    ...
 }