【问题标题】:Build error using MaterialDrawer Library使用 MaterialDrawer 库构建错误
【发布时间】:2015-11-26 11:15:14
【问题描述】:

我正在尝试这个MaterialDrawer library 但我在安装过程中遇到了构建错误。有没有人使用过这个库并且知道是什么导致了这个问题?我已经在他们的 github 页面上打开了一个问题,但是由于 Stackoverflow 有数百万的程序员,我想知道你们中是否有人以前使用过这个库并且知道如何解决这个问题?

这只有一个依赖

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

以下是错误:

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'.

更新构建等级

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
    }


}

【问题讨论】:

标签: android android-library


【解决方案1】:

MaterialDrawer 使用支持库 v23.1.1 那些需要使用 compileSdkVersion 23 构建的库

将您的 gradle 更新为:

compileSdkVersion 23
buildToolsVersion '23.0.2'

并将使用的支持库更新为

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

如果你因为某种原因不能这样做。 (您绝对应该始终选择使用最新的支持库)您可能会从MaterialDrawer 中排除支持库,但我预计这会产生许多奇怪的问题。甚至MaterialDrawer 的 v1.0.0 也使用了支持库 v21.x

【讨论】:

    猜你喜欢
    • 2023-03-27
    • 2015-11-30
    • 2017-10-09
    • 1970-01-01
    • 2019-08-04
    • 2011-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多