Build error using MaterialDrawer Library

六月ゝ 毕业季﹏ 提交于 2019-12-12 02:22:53

问题


I am trying this MaterialDrawer library But I am encountering a build error during setup. Has anyone used this library and knows what could be causing this issue? I already opened an issue on their github page but since Stackoverflow has millions of programmers I am wondering if any of you have used this library before and knows how to resolve this?

This has only one dependency

compile('com.mikepenz:materialdrawer:4.5.1@aar') {
    transitive = true
}

Below is the error:

C:\Dev\AndroidWorkspace\NotBoringActionBar-master\App\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1\res\values-ldltr-v21\values-ldltr-v21.xml
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
C:\Dev\AndroidWorkspace\NotBoringActionBar-master\App\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1\res\values-ldrtl-v23\values-ldrtl-v23.xml
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
C:\Dev\AndroidWorkspace\NotBoringActionBar-master\App\build\intermediates\exploded-aar\com.mikepenz\materialize\0.5.1\res\values-v21\values-v21.xml
Error:(9, 21) No resource found that matches the given name: attr 'android:statusBarColor'.
Error:(8, 21) No resource found that matches the given name: attr 'android:windowDrawsSystemBarBackgrounds'.

UPDATE BUILD GRADLE

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
    }
    buildTypes {
        release {
           // runProguard true
           // proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
        }
    }
    productFlavors {
        defaultFlavor {
            proguardFile 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile('com.mikepenz:materialdrawer:4.5.1@aar') {
        transitive = true
    }


}

回答1:


The MaterialDrawer uses the support libraries v23.1.1 those require to be built with the compileSdkVersion 23

Update your gradle to:

compileSdkVersion 23
buildToolsVersion '23.0.2'

and also update the used support library to

compile 'com.android.support:support-v4:23.1.1'

If you can't do this for some reason. (You definitely always should choose to use the latest support libraries) you may exclude the support libraries from the MaterialDrawer, but I excpect this to create many strange issues. Even v1.0.0 of the MaterialDrawer used the support libs v21.x



来源:https://stackoverflow.com/questions/33937207/build-error-using-materialdrawer-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!