Gradle Sync失败;无法解决依赖关系

时间:2018-01-06 12:20:25

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

所以当我打开我的项目时,我遇到这个问题,当它尝试同步gradle时,它失败并出现一堆错误:

C:\Users\chgam\AndroidStudioProjects\Clicker\app\build.gradle
    Error:Error:Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'a2e1c0f0b1f12751de0faef0779845e8' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Failed to transform file &#39;a2e1c0f0b1f12751de0faef0779845e8&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file '2fb0769f609abbf071245de47adfd63b' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Failed to transform file &#39;2fb0769f609abbf071245de47adfd63b&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file '813170e4070acd24750321f2d7aa30c6' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Failed to transform file &#39;813170e4070acd24750321f2d7aa30c6&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file '02724237b02d3406161e468d55d0060f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Failed to transform file &#39;02724237b02d3406161e468d55d0060f&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'df60192a7dbbce1d6e7507d3af3eb98f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Failed to transform file &#39;df60192a7dbbce1d6e7507d3af3eb98f&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'b068e4e90592ef8aaca000867ae570aa' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Failed to transform file &#39;b068e4e90592ef8aaca000867ae570aa&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform file '514da6f0413adfbef88c6938d6426983' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Failed to transform file &#39;514da6f0413adfbef88c6938d6426983&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform file '723f5eb711364787317896adc48eee21' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Failed to transform file &#39;723f5eb711364787317896adc48eee21&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform file 'a2e1c0f0b1f12751de0faef0779845e8' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Failed to transform file &#39;a2e1c0f0b1f12751de0faef0779845e8&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform file '2fb0769f609abbf071245de47adfd63b' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Failed to transform file &#39;2fb0769f609abbf071245de47adfd63b&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform file '813170e4070acd24750321f2d7aa30c6' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Failed to transform file &#39;813170e4070acd24750321f2d7aa30c6&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform file '02724237b02d3406161e468d55d0060f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Failed to transform file &#39;02724237b02d3406161e468d55d0060f&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform file 'df60192a7dbbce1d6e7507d3af3eb98f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Failed to transform file &#39;df60192a7dbbce1d6e7507d3af3eb98f&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform file 'b068e4e90592ef8aaca000867ae570aa' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Failed to transform file &#39;b068e4e90592ef8aaca000867ae570aa&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform file 'espresso-idling-resource-3.0.1.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Failed to transform file &#39;espresso-idling-resource-3.0.1.aar&#39; to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Failed to transform file 'a2e1c0f0b1f12751de0faef0779845e8' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Failed to transform file &#39;a2e1c0f0b1f12751de0faef0779845e8&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Failed to transform file '2fb0769f609abbf071245de47adfd63b' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Failed to transform file &#39;2fb0769f609abbf071245de47adfd63b&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Failed to transform file '813170e4070acd24750321f2d7aa30c6' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Failed to transform file &#39;813170e4070acd24750321f2d7aa30c6&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Failed to transform file '02724237b02d3406161e468d55d0060f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Failed to transform file &#39;02724237b02d3406161e468d55d0060f&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Failed to transform file 'df60192a7dbbce1d6e7507d3af3eb98f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Failed to transform file &#39;df60192a7dbbce1d6e7507d3af3eb98f&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Failed to transform file 'b068e4e90592ef8aaca000867ae570aa' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Failed to transform file &#39;b068e4e90592ef8aaca000867ae570aa&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@release/compileClasspath': Failed to transform file 'a2e1c0f0b1f12751de0faef0779845e8' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Failed to transform file &#39;a2e1c0f0b1f12751de0faef0779845e8&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@release/compileClasspath': Failed to transform file '2fb0769f609abbf071245de47adfd63b' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Failed to transform file &#39;2fb0769f609abbf071245de47adfd63b&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@release/compileClasspath': Failed to transform file '813170e4070acd24750321f2d7aa30c6' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Failed to transform file &#39;813170e4070acd24750321f2d7aa30c6&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@release/compileClasspath': Failed to transform file '02724237b02d3406161e468d55d0060f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Failed to transform file &#39;02724237b02d3406161e468d55d0060f&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@release/compileClasspath': Failed to transform file 'df60192a7dbbce1d6e7507d3af3eb98f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Failed to transform file &#39;df60192a7dbbce1d6e7507d3af3eb98f&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@release/compileClasspath': Failed to transform file 'b068e4e90592ef8aaca000867ae570aa' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Failed to transform file &#39;b068e4e90592ef8aaca000867ae570aa&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform file 'a2e1c0f0b1f12751de0faef0779845e8' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Failed to transform file &#39;a2e1c0f0b1f12751de0faef0779845e8&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform file '2fb0769f609abbf071245de47adfd63b' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Failed to transform file &#39;2fb0769f609abbf071245de47adfd63b&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform file '813170e4070acd24750321f2d7aa30c6' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Failed to transform file &#39;813170e4070acd24750321f2d7aa30c6&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform file '02724237b02d3406161e468d55d0060f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Failed to transform file &#39;02724237b02d3406161e468d55d0060f&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform file 'df60192a7dbbce1d6e7507d3af3eb98f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Failed to transform file &#39;df60192a7dbbce1d6e7507d3af3eb98f&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>
    Error:Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform file 'b068e4e90592ef8aaca000867ae570aa' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:C:/Users/chgam/AndroidStudioProjects/Clicker/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Failed to transform file &#39;b068e4e90592ef8aaca000867ae570aa&#39; to match attributes {artifactType=jar} using transform AarTransform">Show Details</a>

Project / build.gradle

    // 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.0.1'


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

    allprojects {
        repositories {
            jcenter()
            google()
        }
    }

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

App / build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "ga.venico.clicker"
        minSdkVersion 21
        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'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    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'
}

到目前为止,我已尝试过播放设置,多次删除.gradle文件,以及搜索谷歌时发现的任何内容。

有没有人知道为什么会发生这种情况以及如何解决这个问题? 这是在保存我的项目并构建我的项目并关闭我的电脑然后第二天尝试打开它之后发生的。

2 个答案:

答案 0 :(得分:2)

试试这个

compileSdkVersion 26
buildToolsVersion "26.1.0"

答案 1 :(得分:0)

  1. 确保您的设备已连接到互联网。
  2. 转到文件 - &gt; 设置&amp;展开构建,执行,部署 - &gt; Gradle - &gt; UNCHECK 离线工作 - &gt;行
  3. 转到文件 - &gt;点击使缓存无效/重新启动 - &gt; 无效&amp;重新启动