更新SDK:无法解决:com.android.support:appcompat-v7

时间:2018-08-01 06:39:39

标签: android gradle android-appcompat

我正在使用Android Studio 2.3.3并更新了我的SDK版本,现在我正在使用API​​ 27,但是遇到以下错误:

enter image description here

我还安装了存储库并同步了项目,但是发生了此错误:

enter image description here

此代码为gradle.build(项目):

// 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:2.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

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

此代码也是gradle.build(Module:app)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    buildToolsVersion '28.0.0'
    defaultConfig {
        applicationId "comp.packk.ir"
        minSdkVersion 14
        targetSdkVersion 27
        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:appcompat-v7:27.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:design:27.1.1' 
}

解决方案是什么?

1 个答案:

答案 0 :(得分:1)

implementation or compile 'com.android.support:appcompat-v7:27.1.1'
implementation or compile 'com.android.support:cardview-v7:27.1.1'
implementation or compile 'com.android.support:design:27.1.1'