gpt4 book ai didi

android - Gradle 同步失败 : Could not resolve all artifacts for configuration

转载 作者:行者123 更新时间:2023-12-03 04:55:17 24 4
gpt4 key购买 nike

尝试同步 Gradle 时出现以下错误:

A problem occurred configuring project ':react-native-google-signin'.
> Could not resolve all artifacts for configuration ':react-native-google-signin:classpath'.
> Could not find com.android.tools.build:gradle:3.6.3.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.3/gradle-3.6.3.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.3/gradle-3.6.3.jar
Required by:
project :react-native-google-signin

我进行了搜索,但无法找到答案。这里有一个类似的问题:React native android can not find com.android.tools.build:gradle:3.6.3

看上面这表明关闭离线模式,它没有打开,所以,不幸的是,这不是答案。

根 bundle.gradle 文件如下所示:

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

buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0-alpha1"
reactNativeVersion = "0.59.9"
googlePlayServicesAuthVersion = "16.0.1"
}
repositories {
google()
maven {
url 'https://maven.google.com/'
}
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
maven { url 'https://dl.bintray.com/android/android-tools' }

maven {url "$projectDir/../node_modules/react-native/android"}
}
dependencies {
classpath('com.android.tools.build:gradle:3.4.1')
classpath 'com.google.gms:google-services:4.1.0'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
// React native video - exoplayer missing from google repos, temp fix
maven {
url "https://google.bintray.com/exoplayer/"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
// configurations.all {
// resolutionStrategy {
// force 'com.facebook.android:facebook-android-sdk:4.28.0'
// }
// }
}
}

根据错误,它似乎只在 jcenter 中搜索而不在其他地方搜索?我不确定,但是当我在网上搜索时,这个特定的版本可以从 maven.google.com 获得,其中包括吗?

最佳答案

用这个替换你的android/build.gradle,即在你的项目级gradle中用这个

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'

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

allprojects {
repositories {
mavenLocal()
maven {url "https://maven.google.com"} //<---- this should be added and should be aboce jcenter
maven {url "$rootDir/../node_modules/react-native/android"}
jcenter()
}
}

在那之后清除你在 android/ 中的 gradle

gradlew 干净

然后运行 ​​React Native 应用程序。

注意:在上面的代码 fragment 中使用您自己的 gradle 和 google 服务版本

关于android - Gradle 同步失败 : Could not resolve all artifacts for configuration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61679529/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com