How to find Android SDK 3.0 problem Error: (9, 5) error: android resource: attr / colorError not found

How to find an error in this error, when I did make, I have this error message: Error: (9, 5) error: android resource: attr / colorError not found

It is strange that I have 2 build.gradle files: Here is my build.gradle (Project: Projectname) File:

buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() maven { url "https://maven.google.com" } } } task clean(type: Delete) { delete rootProject.buildDir } 

Here is my build.gradle file (Module: app):

 apply plugin: 'com.android.application' android { compileSdkVersion 22 defaultConfig { applicationId "org.acme.nfcedit" minSdkVersion 22 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' } } productFlavors { } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } 

This file displays /home/users/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/c41e5bc4d98504dc222d4eca88ab6d1b/res/values-v26/values-v26.xml content

 <?xml version="1.0" encoding="utf-8"?> <resources> <style name="Base.Theme.AppCompat" parent="Base.V26.Theme.AppCompat"/> <style name="Base.Theme.AppCompat.Light" parent="Base.V26.Theme.AppCompat.Light"/> <style name="Base.V26.Theme.AppCompat" parent="Base.V26.Theme.AppCompat"> <!-- We can use the platform styles on API 26+ --> <item name="colorError">?android:attr/colorError</item> </style> <style name="Base.V26.Theme.AppCompat.Light" parent="Base.V23.Theme.AppCompat.Light"> <!-- We can use the platform styles on API 26+ --> <item name="colorError">?android:attr/colorError</item> </style> <style name="Base.V26.Widget.AppCompat.Toolbar" parent="Base.V7.Widget.AppCompat.Toolbar"> <item name="android:touchscreenBlocksFocus">true</item> <item name="android:keyboardNavigationCluster">true</item> </style> <style name="Base.Widget.AppCompat.Toolbar" parent="Base.V26.Widget.AppCompat.Toolbar"/> </resources> 

I don't know what mmeaning ?android:attr/colorError

thanks

+4
source share
2 answers

An attribute named "android: attr / colorError" refers to the appcompat library in API 26 and later. But the assembly is compiled using sdk version 22.

So, inside your build.gradle application module, increase your compileSdkVersion to 26 so that it agrees with the version of the appcompat library used.

In other words, right now you have:

 compileSdkVersion 22 implementation 'com.android.support:appcompat-v7:26.1.0' 

But these two versions must be in agreement. So look what happens to:

 compileSdkVersion 26 implementation 'com.android.support:appcompat-v7:26.1.0' 
+13
source

Change compileSdkVersion 22 to compileSdkVersion 26 .

+1
source

Source: https://habr.com/ru/post/1275789/


All Articles