【发布时间】:2018-06-12 16:53:56
【问题描述】:
我收到此错误: 这是我的 build.gradle(Module:app)
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.mycompany.myapp"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding.enabled = true
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:15.0.0'
compileOnly "org.projectlombok:lombok:1.16.20"
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services-places:15.0.0'
implementation 'com.paytm.pgsdk:pgsdk:1.0.8'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.crashlytics.sdk.android:crashlytics:2.9.1'
}
apply plugin: 'com.google.gms.google-services'
这是我的 build.gradle(Project: myApp)
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'io.fabric.tools:gradle:1.25.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我检查了其他解决方案,大多数都建议添加
maven { url "https://maven.google.com" }
到 build.gradle 项目。我已经尝试过了,但我仍然遇到同样的错误。
我使用的是 android studio 3.0。
我也尝试添加 google() 而不是 maven(另一个建议)
【问题讨论】:
-
我个人也有同样的问题,有一次我能抓住一条线
Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://jcenter.bintray.com/com/google/firebase/firebase-messaging/15.0.2/firebase-messaging-15.0.2.pom' CODE 500。所以现在谷歌回购被破坏的可能性很大 -
@AnkushRishi 我在另一个本地帐户的android studio中安装了android studio,它可以工作,可能你需要重新安装android studio和sdks
-
我认为不需要重新安装 android studio,我只需
Clean Project然后Rebuild Project就可以了。 -
@AnirudhBagri:请检查我的答案。
-
Files->使缓存无效并重新启动对我有用。
标签: android android-studio gradle android-gradle-plugin build.gradle