Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

attr/colorError not found error when using com.android.support:recyclerview-v7:26.0.0-beta2

I'm using Android Studio 3.0 Canary 4. I imported the recycler view library. Then it comes out the attr/colorError not found message. This is app build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.robyn.myapplication"
        minSdkVersion 19
        targetSdkVersion 25
        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(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:recyclerview-v7:26.0.0-beta2'
    implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
}

Whenever I add the two libraries implementation 'com.android.support:recyclerview-v7:26.0.0-beta2' and implementation 'com.android.support:appcompat-v7:26.0.0-beta2', it comes out this error message: enter image description here

I tried clean and rebuild, the error message is still there. I checked res/values/colors, the color values are there. Why I get this color error? If I want to use recycler view, what version of library should I import?

like image 392
Robin Avatar asked Jun 20 '17 04:06

Robin


4 Answers

Change the following details it will work fine,

compileSdkVersion 26
buildToolsVersion "26.0.0-beta2"
like image 162
Muthukrishnan Rajendran Avatar answered Nov 19 '22 00:11

Muthukrishnan Rajendran


Also upgrading compileSDKVersion and buildToolsVersion to 26 (it was 25) fixed the issue for me:

compileSdkVersion 26
buildToolsVersion '26.0.2'
...
dependencies {
    ...
    compile 'com.android.support:appcompat-v7:26.0.2'

}

In general, make sure to keep all the versions consistent (compile, build, appcompat libraries).

This is to ensure compilation and stability on runtime (one can also see lint warning about the latter if lint finds differnet support library versions)

like image 36
vir us Avatar answered Nov 19 '22 00:11

vir us


Revision 26.0.0 Beta 2

Please note that 26.0.0-beta2 is a pre-release version. Its API surface is subject to change, and it does not necessarily include features or bug fixes from the latest stable versions of Support Library.

For your problem you can use "26.0.0-beta2" . It will be better if you use Stable Version .

like image 4
IntelliJ Amiya Avatar answered Nov 19 '22 00:11

IntelliJ Amiya


pasting following code at Android/build.gradle bottom helped me:

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion "28.0.3"
            }
        }
    }
}
like image 3
Amit Bravo Avatar answered Nov 18 '22 22:11

Amit Bravo