Search code examples
androidandroid-layoutandroid-actionbarandroid-studio-3.0

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


After updating Android Studio from 2.3 to 3.0 I changed buildToolsVersion from 26.0.0 to 26.0.2 and after that I am getting this error:

Cannot resolve symbol '?attr/actionBarSize

Xml code:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="@color/colorPrimary"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:titleTextColor="@android:color/white"/>

Dependencies:

compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'

Solution

  • 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.