Error in generated values ​​-23 file on Android

I get this error when I try to create my project.

Error:(3, 5) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating'). Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Home\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1 

And when I click on it, it transfers me to the v-23 values ​​file of the generated folder containing the following code.

  <?xml version="1.0" encoding="utf-8"?> <resources> <style name="CardView" parent="Base.CardView"> <item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item> </style> </resources> 

This is my gradle file application

  apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion '23.0.2' defaultConfig { applicationId "com.xxxx" minSdkVersion 19 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:22.2.1' compile 'com.android.support:support-v4:22.2.1' compile 'com.android.support:design:22.2.1' compile 'com.commit451:inkpageindicator:1.0.2' compile 'com.github.bumptech.glide:glide:3.7.0' compile 'ch.acra:acra:4.5.0' compile 'com.pkmmte.view:circularimageview:1.1' compile 'com.google.android.gms:play-services-maps:7.8.0' compile 'com.google.android.gms:play-services-location:7.8.0' compile 'com.facebook.android:facebook-android-sdk:4.+' compile 'com.google.android.gms:play-services:7.8.0' compile 'com.google.code.gson:gson:2.6.2' } 

And when I change everything in gradle to version 23, this error disappears, but since I use http libraries and they are removed from version 23, so I have to use version 22. My project worked perfectly, and suddenly it started giving this error. The only thing I did was install the support repository that I used in another project, and it also starts to give an error in this project. Any way to resolve this error?

+7
android android gradle
source share
3 answers

compile 'com.facebook.android:facebook-android-sdk:4.+' requires V-23

In my case, I use v-22, so I changed the sdk version on Facebook to 4.8 compile 'com.facebook.android:facebook-android-sdk:4.8.0'

+17
source share

This error makes sense, seeing how ?android:attr/colorBackgroundFloating was only added in API 23 and you are using compileSdkVersion 22 .

So, to fix the error, you need compileSdkVersion 23 to include this resource in its assembly. In addition, having a v23 values ​​file does not make sense if you have targetSdkVersion 22 , which says that you have not targeted v23 devices.

And you mentioned that the "http libraries" that you use are gone? If you are referencing the HttpClient from the org.apache package, you can add it back by including it in your build.grade

 android { useLibrary 'org.apache.http.legacy' } 
+6
source share

if you do not want to update your modules, in addition, the solution excludes the modules in build.gradle with the compilation tag

 compile( 'com.facebook.android:facebook-android-sdk:4.11.0') { exclude module: 'cardview-v7' } 
0
source share

All Articles