有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java找不到com的任何匹配项。安卓工具。建造:梯度:2.3+

当我试图通过react native run 安卓构建我的应用程序时,我遇到了这个错误。昨天天气很好,但今天突然出现了这个错误

我已经检查了react原生向量图标,它看起来很好,这也适用于iOS

以下是错误:

   * What went wrong:
A problem occurred configuring project ':react-native-vector-icons'.
> Could not resolve all files for configuration ':react-native-vector-icons:classpath'.
   > Could not find any matches for com.安卓.tools.build:gradle:2.3.+ as no versions of com.安卓.tools.build:gradle are available.
     Searched in the following locations:
         https://jcenter.bintray.com/com/安卓/tools/build/gradle/maven-metadata.xml
         https://jcenter.bintray.com/com/安卓/tools/build/gradle/
     Required by:
         project :react-native-vector-icons

这是我的gradle文件:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        google()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter()
    }
    dependencies {
        classpath 'com.安卓.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:3.2.0'
        classpath 'io.fabric.tools:gradle:1.+'

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

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

ext {
    buildToolsVersion = "26.0.1"
    minSdkVersion = 16
    compileSdkVersion = 26
    targetSdkVersion = 26
    supportLibVersion = "26.1.0"
}

subprojects {

 project.configurations.all {
    resolutionStrategy.eachDependency { details ->
       if (details.requested.group == 'com.安卓.support'
              && !details.requested.name.contains('multidex') ) {
           details.useVersion "26.0.1"
        }
     }
  }

  afterEvaluate {project ->
      if (project.hasProperty("安卓")) {
          安卓 {
              compileSdkVersion rootProject.ext.compileSdkVersion
              buildToolsVersion '26.0.1'
              defaultConfig {
                  targetSdkVersion rootProject.ext.targetSdkVersion
              }
          }
      }
  }
}

我错过了什么


共 (4) 个答案

  1. # 1 楼答案

    尝试将“react native vector icons”软件包更新至最新版本(6.1.0)

  2. # 2 楼答案

    基于此link

    android licenses. Maybe try $ANDROID_HOME/tools/bin/sdkmanager "build-tools;26.0.1" "platforms;android-26" and see if that helps.

    这个图像可以帮助你

    image

    我建议您更新buildToolsVersionsupportLibVersion

  3. # 3 楼答案

    实际上,我已经通过更新react本机向量图标解决了这个问题

    我使用的方法如下所述HERE

  4. # 4 楼答案

    尝试将其添加到build.gradle文件中

    subprojects {
        if (project.name.contains('react-native-vector-icons')) {
            buildscript {
                repositories {
                    jcenter()
                    maven { url "https://dl.bintray.com/android/android-tools/"  }
                }
            }
        }
    }