代码之家  ›  专栏  ›  技术社区  ›  Saeed

更新SDK:未能解析:com.android.support:appcompat-v7

  •  0
  • Saeed  · 技术社区  · 6 年前

    我在用 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(模块: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 回复  |  直到 6 年前
        1
  •  1
  •   Dilavar Malek    6 年前
    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'