android - 错误:(31,5)使用-sdk:minSdkVersion 9不能小于库中声明的版本14

标签 android android-studio gradle dependencies

我正在尝试使用https://github.com/gabrielemariotti/cardslib从github使用Gabriele Mariotti卡库。

当前,我正在使用Android Studio,因此已按照文档中的说明将依赖项添加到我的构建gradle文件中。

这是我的gradle文件的样子

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.0.1"

    defaultConfig {
        applicationId "com.vt"
        minSdkVersion 9
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':facebookSDK')
    compile project(':addslidepanel30')
    compile 'com.android.support:support-v4:21.0.1'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile files('libs/android-support-v7-palette.jar')
    compile files('libs/universal-image-loader-1.9.3-with-sources.jar')
    compile files('libs/volley.jar')

    //Core
    compile 'com.github.gabrielemariotti.cards:cardslib-core:2.0.1'

    //Optional for built-in cards
    compile 'com.github.gabrielemariotti.cards:cardslib-cards:2.0.1'

    //Optional for RecyclerView
    compile 'com.github.gabrielemariotti.cards:cardslib-recyclerview:2.0.1'

    //Optional for staggered grid view
    compile 'com.github.gabrielemariotti.cards:cardslib-extra-staggeredgrid:2.0.1'

    //Optional for drag and drop
    compile 'com.github.gabrielemariotti.cards:cardslib-extra-dragdrop:2.0.1'

    //Optional for twoway  (coming soon)
    //compile 'com.github.gabrielemariotti.cards:cardslib-extra-twoway:2.0.1'
}

但我一直收到此消息错误
Error:(31, 5) uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library C:\Users\SAM-PC\AndroidStudioProjects\vt1.3.0.0 newDB\vt1300newDB\build\intermediates\exploded-aar\com.github.gabrielemariotti.cards\library\1.9.1\AndroidManifest.xml
Error:(31, 5) Execution failed for task ':vt1300newDB:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library C:\Users\SAM-PC\AndroidStudioProjects\vt1.3.0.0 newDB\vt1300newDB\build\intermediates\exploded-aar\com.github.gabrielemariotti.cards\library\1.9.1\AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="it.gmariotti.cardslib.library" to force usage

我试图将card lib的版本更改为稳定版,但是我一直收到相同的错误
dependencies {
    //Core card library
    compile 'com.github.gabrielemariotti.cards:library:1.9.1'

    //Extra card library, it is required only if you want to use integrations with other libraries
    compile 'com.github.gabrielemariotti.cards:library-extra:1.9.1'
}

PS:我是Android Studio的新手,我的项目在Eclipse中可以正常工作,但是由于Google推荐,我正尝试迁移到Android Studio。因此,我非常感谢您的帮助。

最佳答案

将以下内容添加到 list 中:

<uses-sdk android:targetSdkVersion="22" android:minSdkVersion="14"
          tools:overrideLibrary="it.gmariotti.cardslib.library"/>

可以找到更多信息here

关于android - 错误:(31,5)使用-sdk:minSdkVersion 9不能小于库中声明的版本14,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29093502/

相关文章:

安卓工作室 : Javadoc is empty on hover

gradle - Gradle 3.4:使用ConfigSlurper构建配置文件

android - 如何在 android studio 中使用 Jacoco 为 androidTest 生成代码覆盖率报告

android - 解析简单的JSON到android

java - Activity 方向在后台发生变化

Android Studio - SoundPool - 手指从ImageView拿开后停止声音

android - Android Studio错误:(1,0)找不到ID为 'com.android.application'的插件

java - 在 Java 模块 Android Studio 中使用混淆器

Android build.gradle ERROR : ParseError at [row, col] :[65, 9] 消息:预期的开始或结束标记受影响的模块:app

java - 多个 Intent 过滤器到多个 Activity