简体   繁体   中英

Android Studio 3 appcompat resourses not found

Hey I have a problem with Android Studio 3(Beta-2)

Every time I create new/open existing project it shows me following errors:

错误

Clean, Rebuild, Restart Studio, Removing gradle files don't work.

In the studio 2.3, everything is fine.

My build.gradle file:

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's graddle file:

// 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
}

Remove Gradle files (.gradle folder) from your project folder (C:\\Users.....gradle) and try reopening the Android Studio.

Hope this will help.

Change version 25 to 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'
}

Your compile SDK version must match the support library's major version.

Since you are using version 25 of the support library, you need to compile against version 25 of the Android SDK.

Try File -> invalidate caches / Restart . Hope this will help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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