未找到Android Studio 3 appcompat资源

时间:2017-08-17 06:14:12

标签: android android-studio android-gradle

嘿我有Android Studio 3(Beta-2)的问题

每次创建新的/打开现有项目时,它都会显示以下错误:

Error

清理,重建,重新启动Studio,删除gradle文件不起作用。

在工作室2.3中,一切都很好。

我的build.gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    dataBinding.enabled = true
    defaultConfig {
        applicationId "com.valentun.findgift"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
         exclude group: 'com.android.support', module: 'support-annotations'
    })


    annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
    compile 'com.jakewharton:butterknife:8.7.0'

    compile 'com.google.dagger:dagger:2.11'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.11'

    compile 'com.android.support:appcompat-v7:25.4.0'
    compile 'com.android.support:cardview-v7:25.4.0'
    compile 'com.android.support:design:25.4.0'


    compile 'com.google.firebase:firebase-storage:11.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.retrofit2:converter-jackson:2.3.0'
    compile 'com.github.aakira:expandable-layout:1.6.0@aar'
    testCompile 'junit:junit:4.12'

}


apply plugin: 'com.google.gms.google-services'

Project的graddle文件:

// 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-beta2'
    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()
    maven {
        url 'https://jitpack.io'
    }
    maven {
        url "https://maven.google.com"
    }
}
}

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

4 个答案:

答案 0 :(得分:0)

从项目文件夹中删除Gradle文件(.gradle文件夹)(C:\ Users ..... gradle)并尝试重新打开Android Studio。

希望这会有所帮助。

答案 1 :(得分:0)

将版本25更改为26

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
    applicationId "seesaa.vn.testandroidstudio"
    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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.0'
}

答案 2 :(得分:0)

您的编译SDK版本必须与支持库的主要版本匹配。

由于您使用的是支持库的25版,因此需要针对Android SDK的第25版进行编译。

答案 3 :(得分:0)

尝试文件 - >使缓存无效/重新启动。希望这会有所帮助。