1

I have added that library to my gradle file.

So I did as described in the tutorial of the library and just added the dependency to my gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.0'
    defaultConfig {
        applicationId "com.jublikon.timerapp"
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main { res.srcDirs = ['src/main/res', 'src/main/res/drawable/ic_action_search.png'] }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')

    //Google Libraries
    compile 'com.android.support:appcompat-v7:22.0.+'
    compile 'com.android.support:recyclerview-v7:22.0.+'
    compile 'com.android.support:cardview-v7:22.0.+'

    //Third party libraries
    compile 'com.mcxiaoke.volley:library:1.0.6'
    compile 'com.nispok:snackbar:2.10.+'
    compile 'com.joanzapata.pdfview:android-pdfview:1.0.+@aar'
    compile 'jp.wasabeef:recyclerview-animators:1.2.0@aar'
    compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.4'
}

So I am getting the following gradle issue:

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'

Why is a resource file getting into trouble when I add a third party library?

The file where the issue is linked to (v23/values-v23.xml):

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Base.TextAppearance.AppCompat.Widget.Button.Inverse" parent="android:TextAppearance.Material.Widget.Button.Inverse"/>
    <style name="Base.Theme.AppCompat" parent="Base.V23.Theme.AppCompat"/>
    <style name="Base.Theme.AppCompat.Light" parent="Base.V23.Theme.AppCompat.Light"/>
    <style name="Base.V23.Theme.AppCompat" parent="Base.V22.Theme.AppCompat">
        <!-- We can use the platform drawable on v23+ -->
        <item name="actionBarItemBackground">?android:attr/actionBarItemBackground</item>

        <item name="controlBackground">@drawable/abc_control_background_material</item>
    </style>
    <style name="Base.V23.Theme.AppCompat.Light" parent="Base.V22.Theme.AppCompat.Light">
        <!-- We can use the platform drawable on v23+ -->
        <item name="actionBarItemBackground">?android:attr/actionBarItemBackground</item>

        <item name="controlBackground">@drawable/abc_control_background_material</item>
    </style>
    <style name="Base.Widget.AppCompat.Button.Colored" parent="android:Widget.Material.Button.Colored"/>
</resources>

Hope someone can help me. Similar threads had no answer that was able to solve my problem

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
jublikon
  • 3,427
  • 10
  • 44
  • 82
  • Are you having the minimum SDK level at 21? Then I think you should remove the Google libraries, as they are only useful for backwards compatibility. I seen cases when the appcompat library was also implemented in one of the 3rd party libraries I used, and that made the build and compilation fail with some really weird error messages. It helped me once i removed the appcompat support libraries and cleaned up my project. – anthonymonori Oct 08 '15 at 10:53
  • Check your libraries. Some of them are using appcompat v23 which require api23 to compile. – Gabriele Mariotti Oct 08 '15 at 10:57

2 Answers2

2

This library

compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.4'

has a dependency with the appcompat v23.
Here the pom file.

 <dependencies>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>appcompat-v7</artifactId>
      <version>23.0.0</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>

The Appcompat v23 requires API23 to compile.
It is the reason of your issue.

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'

You can exclude this dependency, but you could have issue with the library. I suggest you changing the compileSdkVersion to 23 in your build.gradle

 compileSdkVersion 23
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • The idea to change the compileSdkVersion to 23 is simple and fine. But I use ActionBarActivity. The app will not run. Changing it to AppCompatActivity the project still containts errors like: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false } – jublikon Oct 08 '15 at 12:34
  • found a solution: http://stackoverflow.com/questions/30000654/getting-appcompat-does-not-support-the-current-theme-features-exception-after-up – jublikon Oct 08 '15 at 12:38
  • @jublikon You have to do some changes in your theme to set the missing attributes. Pay attention to targetSdk. You can use 22. Using 23 you have to manage the new runtime permiossions. – Gabriele Mariotti Oct 08 '15 at 12:39
0

I faced gradle error and I found out the solution from the following link. It works for me.

compile ('com.android.support:support-v4:23.2.1'){ force=true; }

Error inflating class android.support.design.widget.CollapsingToolbarLayout

Martin Evans
  • 45,791
  • 17
  • 81
  • 97