6

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

Community
  • 1
  • 1
k9yosh
  • 858
  • 1
  • 11
  • 31
  • Have you tried cleaning the project after changing the values. It seems that you are using: android:TextAppearance.Material.Widget.Button.Inverse which does not exist. I would recommend searching for that in the project and replace it with something. My guess is that the previous machine had something cached in his m2 folder, which picks up dependecies you don't have – Joakim Engstrom Jan 26 '16 at 15:14
  • Also make sure you have the android support library downloaded. – Joakim Engstrom Jan 26 '16 at 15:14
  • @JoakimEngstrom Yes i do clean and rebuild the project every-time and i do have the necessary support libraries downloaded. And about the TextAppearance.Material.Widget.Button, I don't use it in the project. In fact when i create a new Project it automatically add that values-v23.xml in the following path \\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml. Even if i delete this file (Since i do not use it) It is automatically generated again when i sync/clean/rebuild the project. – k9yosh Jan 26 '16 at 16:37
  • I did check on the dependencies for the play services, and they are dependent on a newer version of the support library that you are using. Maybe you should try bumping the support libraries to the same that the play services are using, which I would think is 23.1.1 – Joakim Engstrom Jan 27 '16 at 10:13
  • I think this is a dependency issue never the less. If you run gradle dependencies on your APP MODULE, not the root app folder, in the terminal. You will get a nice tree, see that all the support libraries are matching each other. Because every 3:rd party library you are using has dependencies too. If a jar is depending on another version of the support lib, you have to grab a new version of that lib. – Joakim Engstrom Jan 27 '16 at 10:17
  • @JoakimEngstrom by Play services you mean the Support Library right (appcompat-v7) ? – k9yosh Jan 27 '16 at 10:28
  • @JoakimEngstrom Assuming that you meant using a higher version of com.android.support:appcompat-v7 library (Sorry if i misunderstood this), there would be a version mismatch right? I want to build this project using API 22 and if i use a 23 Support Library it will give an error. (Please correct me if i misunderstood what you said "Maybe you should try bumping the support libraries to the same that the play services are using, which I would think is 23.1.1") – k9yosh Jan 27 '16 at 10:37
  • But then maybe downgrading the play services in that case. The reason I recommended debugging the dependecies was because of this. – Joakim Engstrom Jan 27 '16 at 11:17
  • That said, you could say compileSDK 23 and targetSDK be 22, it's always recommended to use the latest when compiling the app. – Joakim Engstrom Jan 27 '16 at 11:17
  • @JoakimEngstrom AFAIK you can't downgrade below the compiling SDK version or use a higher version than the compiling SDK. Yes i always use the same SDK to both compile & target. And also i tried going with the SDK 23 which solves this problem, but leads to other problems. (refer the last link i have posted in the question, that's exactly what happens to me) but i can't resolve that. It rejects apache httpclient dependancies in my project which ultimately leads to compiling errors. Anyway thanks for taking your time to look at this. – k9yosh Jan 27 '16 at 11:54
  • You can have different targetSDK and compileSDK. You can downgrade play services. And with Apache you can add useLibrary 'org.apache.http.legacy' to the gradle file. – Joakim Engstrom Jan 28 '16 at 10:19
  • no worries, these kind of things intrest me. – Joakim Engstrom Jan 28 '16 at 10:20
  • 1
    @JoakimEngstrom i'm trying to build the project with play services 7.5.0. For some reason my project external libraries get updated to version 23 support annotations, appcompat-v7 and support-v4. Although i have declared my dependencies in the gradle file to use version 22. I noticed that this happens when i add the play services dependency with the + mark. Since it downloads the latest versions of it. So it might be upgrading the rest of the dependencies to its highest levels. I'm trying to build now explicitly setting the version to 7.5.0. Hope this works. – k9yosh Jan 28 '16 at 10:27
  • If it works I can add an answer to this, or you. Whichever you prefer. – Joakim Engstrom Jan 28 '16 at 10:44
  • @JoakimEngstrom yes sure you can add it as an answer. For some reason gradle is taking soo much time to run its scripts. It's been 50 mins now still running. Idk wth is wrong with this thing. I had to kill the studio previously since i waited another 50 mins till this thing finish running it's script. – k9yosh Jan 28 '16 at 10:47
  • Gradle :/... I know it sometimes can lock the cache, so to manually remove the gradle cache from both the home folder and project folder. And then do a gradle clean usually fixes these things. – Joakim Engstrom Jan 28 '16 at 10:56
  • 1
    @JoakimEngstrom it worked :) using play services 7.5.0 did the job. – k9yosh Jan 28 '16 at 12:39
  • Awesome @k9yosh I added an answer to the question. :) – Joakim Engstrom Jan 28 '16 at 16:38

1 Answers1

9

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.

Joakim Engstrom
  • 6,243
  • 12
  • 48
  • 67
  • When i downgrade play services Android studio asks me to install the repository, buy it seem is not available for download anymore. I dont want to upgrade compile version because im at the edge of publishing my app, and i don't wanna handle changes in classes error bugs.ç – Danfoa Feb 05 '16 at 23:55
  • @DanielOrdoñez what is the version you want? – k9yosh Feb 08 '16 at 08:08
  • One that works :P, thanks but i finally resolve the issue and downgrade to 7.8, in the next update of my app im going to renew all repositories, put you save my life thanks. – Danfoa Feb 11 '16 at 01:15
  • As I downgrade the Play Services to 7.4.0 it is showing "Error:(95, 0) Version: 7.4.0 is lower than the minimum version (9.0.0) required for google-services plugin. Open File" – Sushant Garg Jun 07 '17 at 07:48