Android - Faild解决:com.android.support:appcompat-v7:26.0.0

时间:2017-08-31 11:18:57

标签: android gradle

我的错误是

  

解决的问题:com.android.support:appcompat-v7:26.0.0

我将Android工作室版本升级到3.0 Canary 8.然后,发生了此错误 我的项目级gradle文件是:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
repositories {
    maven {
        url "https://maven.google.com"
    }
}

我的应用级gradle文件是:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "hojune.intelibag"
        minSdkVersion 17
        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 {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:design:26.0.0-alpha1'
    compile 'com.google.android.gms:play-services:11.0.4'
    compile 'com.android.support:appcompat-v7:26.0.0'
}
apply plugin: 'com.google.gms.google-services'

如何处理此错误?

3 个答案:

答案 0 :(得分:0)

在项目级build.gradle文件中,删除:

repositories {
    maven {
        url "https://maven.google.com"
    }
}

然后将该文件中的allprojects闭包更改为:

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

答案 1 :(得分:0)

从SDK管理器更新您的Android支持存储库。

答案 2 :(得分:0)

这里有' -alpha1'最后

compile 'com.android.support:design:26.0.0-alpha1'

在这里写相同的

compile 'com.android.support:appcompat-v7:26.0.0' to 

compile 'com.android.support:appcompat-v7:26.0.0-alpha1'