Cannot resolve symbol '?attr/actionBarSize' after updating Android Studio from 2.3 to 3.0 for buildToolsVersion '26.0.2'

一笑奈何 提交于 2019-12-02 14:46:21
Victoria Klimova

Nothing helped, but changing:

?attr/actionBarSize to ?android:attr/actionBarSize did the job.

That's actually a bug in few versions. Even if you won't fix it, Android will automatically fix it at runtime.

Update all your library versions to 26.1.0 (to the most recent version) and also add:

compile 'com.android.support:support-v4:26.1.0'

if you are using Android Studio 3.0.0 and above then use

implementation 'com.android.support:support-v4:26.1.0'

Sync your project and the error will automatically resolve because ?attr/actionBarSize is part of v4 library.

In the project directory hierarchy switch "Android" to "Project". Then delete a folder ".idea/libraries", only "libraries". Select an option from the menu "File -> Invalidate Caches / Restart... -> Invalidate and Restart".

Good day, I know this is a bit late.

but I have encountered this one too, when I updated to Android Studio 3.0

what i did is I changed

compile 'com.android.support:support-v4:26.1.0'

to

implementation 'com.android.support:support-v4:26.1.0'

Hope it can help somebody.

This is what I did to fix exactly the same problem. 1. Go to SDK manager. 2. Check Android API 27 and Android 8.0 (Oreo) 3. Click "Apply" to download and install those SDKs 4. In build.gradle, change the 'buildToolsVersion "26.0.1"' to 'buildToolsVersion "26.0.2"' and do a gradle sync.

Hope this can help fix your issue.

Your buildToolsVersion version differs from version in dependencies (e.g. buildToolsVersion is 27.0.0 but implementation 'com.android.support:support-v4:27.0.1'). Make them the same.

my problem solved by changing compileSdkVersion and targetSdkVersion from 26 to the last version 27, also u need to upgrade ur dependencies to 27.

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com......"
        minSdkVersion 15
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
}

hope this solve ur problem too :)

petryk33

Try to add this in your build.gradle(app) dependencies:

resolutionStrategy {
    force libraries.support.appCompat
    force libraries.support.design
    force 'com.android.support:support-utils:26.0.1'
    force 'com.android.support:support-compat:26.0.1'
}

This worked.

I have updated the compile and support lib versions from 26.x.x to 27.x.x.

I tried all the answers here and so many others from lots of places but only the below techniques worked for me. The simple way is you just need to close the project then import the same project as a Gradle project Or you can go to Project structure -> project -> change Gradel plugin = 4.4 and Android plugin version = 3.1.4. Both of these above methods work.

Note: These versions(4.4, 3.1.4) are latest when I write this answer please use the latest version instead of these.

Maybe you hava upgraded the version of gradle. when my gradle version is 4.4 and plugin version is 3.1.1.It is ok.

this work:

delete all file in $HOME/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar

Changed all Support Library versions to the newest 27.1.1 and the error was gone.

please replace android support libraries.

from

27.1.1

to

28.0.0-alpha3

and replace 27 to 28 for following cases:

compileSdkVersion 28
buildToolsVersion "28.0.0"
targetSdkVersion 28

this will fix the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!