【问题标题】:React native android can not find com.android.tools.build:gradle:3.6.3React Native android 找不到 com.android.tools.build:gradle:3.6.3
【发布时间】:2020-04-22 06:40:11
【问题描述】:

任何人都遇到了这个问题无法解决配置“:react-native-fast-image:classpath”的所有工件并且找不到com.android.tools.build:gradle:3.6.3?我尝试打开项目结构,看到 gradle 插件工具是 3.6.3,gradle 版本是 5.4.6 但我不知道现在发生了什么

build.gradle 文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    /*ext {
        buildToolsVersion = "28.0.2"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 27
        supportLibVersion = "28.0.0"
    }*/
    repositories {
        jcenter()
        google()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.google.gms:google-services:4.0.1'

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

allprojects {
    repositories {
        configurations.all {
            resolutionStrategy.eachDependency { details ->
                def requested = details.requested
                if (requested.group == 'com.google.android.gms') {
                    details.useVersion '12.0.1'
                }
                if (requested.group == 'com.google.firebase') {
                    details.useVersion '12.0.1'
                }
            }
        }
        mavenLocal()
        mavenCentral()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.1.1"
            }
        }
    }
}
ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 28
    supportLibVersion = "28.0.0"
    googlePlayServicesVersion = "15.0.1"
    androidMapsUtilsVersion = "0.5+"
}
project.ext {
    excludeAppGlideModule = true
}

/*
task wrapper(type: Wrapper) {
    gradleVersion = '4.7'
    distributionUrl = distributionUrl.replace("bin", "all")
}
*/

【问题讨论】:

    标签: android react-native gradle


    【解决方案1】:

    我将google()添加到build.gradle以解决问题:

     buildscript {
        repositories {
            jcenter()
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.6.3'
        }
    }
    
    allprojects {
        repositories {
            jcenter()
            google()
        }
    }
    

    【讨论】:

      【解决方案2】:

      我遇到了类似的问题……只是我的问题与“react-native-fast-image:classpath”无关。我的是 原因:

      org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: 无法解析配置 ':classpath' 的所有工件

      我在 build.gradle 文件中添加了“google()”,它对我有效。

      buildscript {
          repositories {
              jcenter()
              google()
          }
          dependencies {
              classpath 'com.android.tools.build:gradle:3.6.3'
      
      
      allprojects {
          repositories {
              jcenter()
              google()
          }
      }
      

      【讨论】:

        【解决方案3】:

        我也有一个问题,没有找到 com.android.tools.build:gradle:3.6.3,但没有使用 React,在我的情况下它有效。 Check here.

        【讨论】:

          【解决方案4】:

          我修复了它,它是反应原生快速图像,使用与我的工具版本不同的版本......

          【讨论】:

            【解决方案5】:

            我遇到了同样的问题,并会尝试测试您的解决方案是否也适用于我,但是有关如何解决此问题的任何更好的信息:“反应原生快速图像使用不同的版本和我的工具版本”:)

            干杯

            【讨论】:

            • 我在 android studio 的 bundle.gradle 中检查了不同的构建工具版本,其中包含来自 node_modules 的 react native fast image ...
            猜你喜欢
            • 1970-01-01
            • 2019-05-11
            • 1970-01-01
            • 1970-01-01
            • 2019-02-27
            • 2022-08-02
            • 2019-05-10
            • 1970-01-01
            • 2016-03-13
            相关资源
            最近更新 更多