Android构建错误:无法解析配置的所有依赖项':app:androidJacocoAgent'

时间:2017-02-11 09:09:35

标签: android android-studio gradle jacoco

错误:无法解析配置的所有依赖项':app:androidJacocoAgent'。

  

找不到org.jacoco:org.jacoco.agent:0.7.5.201505241946。     在以下位置搜索:         文件:/home/locationXXX/Android/Sdk/extras/m2repository/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.pom         文件:/home/locationXXX/Android/Sdk/extras/m2repository/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.jar         文件:/home/locationXXX/Android/Sdk/extras/google/m2repository/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.pom         文件:/home/locationXXX/Android/Sdk/extras/google/m2repository/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.jar         文件:/home/locationXXX/Android/Sdk/extras/android/m2repository/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.pom         文件:/home/locationXXX/Android/Sdk/extras/android/m2repository/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.jar         文件:/home/locationXXX/Documents/android-studio_new/gradle/m2repository/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.pom         文件:/home/locationXXX/Documents/android-studio_new/gradle/m2repository/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.jar     要求:         是MyHome:应用程序:未指定的

将工作室升级到2.2.3后出现此错误 Gradle版本2.14.1 distributionUrl = HTTPS://services.gradle.org/distributions/gradle-2.14.1-all.zip

以下是我的gradle依赖项

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/androidasync-2.1.6.jar')
    compile files('libs/gson-2.6.2.jar')
    compile 'com.google.android.gms:play-services:9.4.0'
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:support-v4:25.0.0'
    compile 'com.android.support:recyclerview-v7:25.0.0'
    compile 'com.android.support:preference-v7:25.0.0'
    compile 'com.android.support:design:25.0.0'
    compile 'com.google.firebase:firebase-messaging:9.4.0'
}




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

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

    defaultConfig {
        applicationId "com.test.myhome"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 5
        versionName "5"
        multiDexEnabled true
        jackOptions {
            enabled true
        }
    }
    buildTypes {
        release {
            minifyEnabled true
            //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }


    useLibrary 'org.apache.http.legacy'

    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/androidasync-2.1.6.jar')
    compile files('libs/gson-2.6.2.jar')
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:preference-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
}

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

1 个答案:

答案 0 :(得分:1)

将gradle版本更新为2.14.1后,您是否已将Android gradle构建工具更新为2.2.3

buildscript {
  ...
  dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'
  }
}

修改

 repositories {
        mavenCentral()
        jcenter()
    }

将此行添加到appcompact行之上,如下所示

compile group: 'org.jacoco', name: 'org.jacoco.agent', version: '0.7.5.201505241946'
compile 'com.android.support:appcompat-v7:23.1.1'