繁体   English   中英

错误:无法解析':app @ debug / compileClasspath'的依赖项:无法解析com.android.support:appcompat-v7:26.0.0-beta1

[英]Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.0.0-beta1

我有android studio 2.3.3,我安装android studio 3.0.1。 我无法同步项目

这是我的错误:

E:\AndroidProject\...\app\build.gradle
    Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.0.0-beta1. Open File Show Details

Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.0.0-beta1.

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0-beta1. 
....

我的应用build.gradle

    apply plugin: 'com.android.application'
            android {
        compileSdkVersion 26
        buildToolsVersion '26.0.2'
        defaultConfig {
            applicationId "com.avana.xxx"
            minSdkVersion 14
            targetSdkVersion 26
           ...
        }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
    compile 'com.android.support:appcompat-v7:26.0.0-beta1'
    compile 'com.android.support:cardview-v7:26.0.0-beta1'
    compile 'com.android.support:design:26.0.0-beta1'
}

的build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

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

gradle.wrapper

  distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

转到setting->build->gradle ,然后取消选中offline-work按钮。 然后重建你的程序。

和你的问题一样

只需更改build.gradle(Project:testApp),

只要按照顺序和你做,你需要添加谷歌储存库中,并在allprojects仓库, 随后 ,别忘了加上“任务干净(..){..}”

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

    }
}

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM