无法解析com.android.tools.build:gradle:3.3.2 [英] Could not resolve com.android.tools.build:gradle:3.3.2
问题描述
我试图将Firebase身份验证添加到我的android项目中,但出现此错误. 我也尝试添加'com.google.firebase:firebase-core:16.0.3',但是它花费了40多分钟,仍然没有同步gradle.
I was trying to add firebase auth to my android project but getting this error. I have tried adding 'com.google.firebase:firebase-core:16.0.3' too but its taking more than 40 mins and still not syncing the gradle.
这是build.gradle文件:
This is build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myaid.startup"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
这是app.gradle文件:
This is app.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是错误:
失败:构建失败,并出现异常.
FAILURE: Build failed with an exception.
-
出了什么问题:配置根项目"MyAid"时出现问题.
What went wrong: A problem occurred configuring root project 'MyAid'.
无法解析配置':classpath'的所有工件. 无法解析com.android.tools.build:gradle:3.3.2. 要求者: 项目 : 无法解析com.android.tools.build:gradle:3.3.2. 无法获取资源' https ://jcenter.bintray.com/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom ". 无法获取' https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom ". 连接重置
Could not resolve all artifacts for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:3.3.2. Required by: project : Could not resolve com.android.tools.build:gradle:3.3.2. Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom'. Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom'. Connection reset Could not resolve com.android.tools.build:gradle:3.3.2. Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom'. Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom'. Connection reset
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.与--scan一起运行以获得完整的见解.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
在2m 13s内配置失败ERROR:连接重置
CONFIGURE FAILED in 2m 13s ERROR: Connection reset
推荐答案
我已经解决了此问题,方法是删除所有.gradle文件,SDK文件,.m2文件,.androidstudio文件,然后重新安装.
I have resolved this problem by removing all my .gradle files, SDK files, .m2 files, .androidstudio files and then re-installing it.
遵循此答案:如何完全卸载Android Studio
这篇关于无法解析com.android.tools.build:gradle:3.3.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!