使用Gradle构建项目时出错

时间:2017-02-18 20:03:18

标签: android android-studio android-gradle build.gradle

我更新了Android Studio,然后我无法构建应用

这是我从Gradle发来的消息

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not resolve com.google.android.gms:play-services-identity:10.2.0.
 Required by:
     BT_QuinielaCatamarca:app:unspecified > com.google.android.gms:play-services:10.2.0
     BT_QuinielaCatamarca:app:unspecified > com.google.android.gms:play-services:10.2.0 > com.google.android.gms:play-services-wallet:10.2.0
   > Could not resolve com.google.android.gms:play-services-identity:10.2.0.
     > Could not parse POM D:\Android\Sdk\extras\google\m2repository\com\google\android\gms\play-services-identity\10.2.0\play-services-identity-10.2.0.pom
        > Content is not allowed in prolog.
 > Could not resolve com.google.android.gms:play-services-nearby:10.2.0.
 Required by:
     BT_QuinielaCatamarca:app:unspecified > com.google.android.gms:play-services:10.2.0
  > Could not resolve com.google.android.gms:play-services-nearby:10.2.0.
     > Could not parse POM D:\Android\Sdk\extras\google\m2repository\com\google\android\gms\play-services-nearby\10.2.0\play-services-nearby-10.2.0.pom
        > Content is not allowed in prolog.

这是我的build.gradle文件 该应用程序使用jsoup库来解析

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "info.blacktrail.quinielacatamarca"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 13
    versionName "3.47"
    multiDexEnabled true
}
buildTypes {
    debug {
        debuggable true
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
dexOptions {

    javaMaxHeapSize "4g"
}
}
repositories {
mavenCentral()

}
 dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.android.gms:play-services:10.2.0'
compile files('libs/jsoup-1.8.1.jar')

compile files('libs/htmlcleaner-2.16.jar')
}

我尝试了几件事,例如更改BuildTools或其他SDK版本

1 个答案:

答案 0 :(得分:0)

尝试将此行添加到您的gradle(级别应用)的末尾:

apply plugin: 'com.google.gms.google-services'

您还必须在项目级gradle中将google-services添加到您的类路径:

classpath 'com.google.gms:google-services:3.0.0'

确保您已在SDK中的Google repository下安装了Extra