Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Project Build Fails with Error retrieving parent for item: No resource found that matches the given name

I recently installed a fresh copy of Android Studio Version 1.5.1. And i imported a project that was built on a previous version of Android Studio and tried loading into the IDE. But it started giving me this error.

Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\yomal.ds\AppData\Local\Android\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1
C:\Users\yomal.ds\AndroidStudio_Workspace\ClaimAssistant\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

I checked my gradle.build which was looking fine as far as i could see. Here's my gradle.build file.

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.informaticsint.claimassistant"
    minSdkVersion 14
    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'])
    compile files('libs/gcm.jar')
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.google.android.gms:play-services-identity:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
}

I tried creating a new project and adding previous project sources to the new one. But this error pops up when i set the SDK version to 22.

this is the same thing that happened to me, but the answers didn't work. Error retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23

I tried downgrading the support library versions for each of their releases from 22 - 22.2.1

But when i set the project to compile in SDK 23 it works fine but leads to some other problems. This is what happens when i do this. resource error in android studio after update: No Resource Found

like image 644
k9yosh Avatar asked Jan 26 '16 15:01

k9yosh


1 Answers

The problem, as we figured out in the comments, was a mismatch in dependency.

As the question shows it's compiling against the 22 api version. The support libraries must correspond to the compile sdk version, which it does in this instance.

But the 8.4.0 Play Services actually depends on the 23+ support libraries, and it's not finding the resources, due to the 22 compileSdk and 22+ version on the support library.

To fix these there are two solutions:

  1. Downgrade the Play Services to 7.4.0
  2. Upgrade compileSdk and support-library to version 23

The easiest way to debug mismatches in versions are to run

 .gradlew dependencies

On you app module (no the root of the project), so the terminal command would be something like

 cd app-folder/
 ../gradlew dependencies

And then check the dependency tree to see if something stands out.

like image 151
Joakim Engstrom Avatar answered Sep 20 '22 22:09

Joakim Engstrom