29

I'll start from what I want to achieve: building the googlecast-manager example provided here: https://github.com/googlecast/GameManagerSamples I followed instructions here: https://developers.google.com/cast/docs/android_sender

So first I downloaded from github the project, then with the Android SDK Manager I downloaded Android Support Libraries and Google play Services. Then in my project, I went to "Open Modules Setting->Add" then went to "Android SDK\extras\android\support\v7\appcompat" and added it.

Then first step to ensure it's working is to build it. So I right clicked on appcompat->"Compile Module Appcompat" but it fails with 2 errors:

  1. Error:(20, -1) android-apt-compiler: [appcompat] D:\Android SDK\extras\android\support\v7\appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

  2. Error:(19, -1) android-apt-compiler: [appcompat] D:\Android SDK\extras\android\support\v7\appcompat\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

Doing the same for Google Play works like a charm.

I've tried to find videos/other similar issues but it's either too complicated or not my problem.

Here is the AndroidManifest.xml of appcompat:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="android.support.v7.appcompat">
<uses-sdk android:minSdkVersion="9"
    android:targetSdkVersion="19"/>
<application />

Here is what is installed from the Android SDK Manager: SDK Manager top SDK Manager bottom

13 Answers 13

56

I also encountered the same problem and now have fixed it. What you just have to do is

  1. Inside your Android Studio
    1. press Shift button two times, a search box will appear type build.gradle
    2. choose build.gradle module:app from the suggestion.
    3. major version of compileSdkVersion and support libraries under dependencies should be same as following code depict.
  2. Inside Eclipse
    find build.gradle module:app and do the same.

Note: download and install properly the latest API which is now API 23.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "com.example.inzi.app"
        minSdkVersion 9
        targetSdkVersion 23
        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 'com.android.support:appcompat-v7:23.0.0'
}
4
  • How do you do that in Eclipse. The OP is also using Eclipse.
    – Solace
    Aug 23, 2015 at 9:22
  • 3
    @Solace you can change it inside your project.properties file
    – LeoFarage
    Aug 28, 2015 at 14:12
  • I think this will fix it for me, but i am using apache cordova and that re-generates the entire project at build. So i could change all that but before compiling it will overwrite it. Is there a way in which i can do this without changing the project?
    – x13
    Nov 27, 2015 at 8:22
  • @ThisNameBetterBeAvailable yes you can do it as in build.gradle file set compileSdkVersion and support:appcompat dependencies to 22 Jul 28, 2016 at 15:23
13

I believe you should upgrade your compileSdkVersion. Check your build.grade file, should be something like:

android {
    compileSdkVersion 23 // <- here
    buildToolsVersion "23.0.0" // <- here

    defaultConfig {
        applicationId "your.id"
        minSdkVersion 11
        targetSdkVersion 23 // <- and maybe here
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        ....
    }
}

Of course you will need to download the newest Android SDK and build tools (and whatever else you need) from the SDK Manager.

1
  • in Android Studio 1.3.2 on mac, you can also edit these properties by going to File > Project Structure..., then under "Modules" choose your project folder, many times labeled "app" and under the Properties tab you can change your Compile Sdk Version and Build tools Version from their drop down menus. As well as under the "Flavors" tab you can choose your Min Sdk Version and Targer Sdk Version from the drop downs menus.
    – nommer
    Aug 26, 2015 at 19:07
6

If you are working in Eclipse do the following:

  1. In your AndroidManifest.xml file change android:targetSdkVersion to 23
  2. Open Project settings (ALT + Enter while focused in Project Explorer)
  3. Go to Android tab and in Project Build Target section mark Android 6.0
  4. Clean and build your project

NOTE: when you do this have in mind that Android OS would treat your app as if it was designed to work on Android M. So for example if you use some dangerous permissions you should add routines to check then on runtime.

4

You have to update your SDK to the API 23 that is either not downloaded or not installed properly.

In your build.gradle set

compileSdkVersion 23
    buildToolsVersion "23.0.0"


    targetSdkVersion 23
compile 'com.android.support:appcompat-v7:23.0.0'
3

I actually found the answer for my problem and the person above was right. The Module SDK set to compile the module was 22.0 and not 23.0. To fix that I did the following. Right click on appcompat: "Open Module Setting -> Modules SDK": New. I Chose the folder containing the whole Android SDK and chose the last Android (e.g. 6.0) with the last Module SDK 23.0.

Module SDK Select

3

Either revert to appcompact-v22 or update to android api v23

3

You have to update your SDK to the API 23 that is either not downloaded or not installed properly. Make sure your compileSdkVersion and dependencies version should be same.

2

I was having problem with new appcompat V-23 as my target sdk is 21. So I did following two steps and it works perfectly for me..

1) Delete the values-23 folder in res folder.

2) I was getting error on the src folder as well, so commented the only line inside main() of snippet.java as we do not require it.

Then add this project as library to your project.. Hope it helps.

1
  • Thanks bro. I did not want to update to 23 since I was targeting 21 as well. Nice find. Jan 16, 2016 at 18:49
1

I resolved like below

android {
    compileSdkVersion "Google Inc.:Google APIs:21"
    buildToolsVersion "23.0.0"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
}

replaced the above dependencies with below...

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:7.8.0'
}
1

To correct this error in android studio procceded like this : i went to sdk manager and i downloaded and updated all packages of android api 23 file => project structure and i changed compile sdk version from 21 to 23 and build tools version from 21 to 23

1

The problem generally occurs due to version issues. The following dependencies and compilesdkversion Worked for me:-

apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
    minSdkVersion 14
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE-FIREBASE.txt'
    exclude 'META-INF/NOTICE'
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
   }
 }

dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:support-v13:23.0.+'
compile 'com.firebase:firebase-client-android:2.2.4+'
}
0

The answer #31 & #11 in this discussion can solve this issue: https://code.google.com/p/android/issues/detail?id=183122

0

My issue was, one of my un-used dependencies was using sdk-23 version. So after removing those un-used dependencies it worked like a charm.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.