我正在尝试使用Gabriele Mariotti卡片库,使用https://github.com/gabrielemariotti/cardslib从github。
目前我正在使用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
我试图将卡片库的版本更改为稳定版,但我一直都会遇到同样的错误
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中工作得很好,但是我试图迁移到Android Studio,因为它是谷歌推荐的。所以我非常感谢你的帮助。
答案 0 :(得分:1)
将以下内容添加到您的清单中:
<uses-sdk android:targetSdkVersion="22" android:minSdkVersion="14"
tools:overrideLibrary="it.gmariotti.cardslib.library"/>
可以找到更多信息here。
答案 1 :(得分:0)
您应该像这样更改AndroidManifest.xml
:
<uses-sdk android:targetSdkVersion="22" android:minSdkVersion="14"
tools:overrideLibrary="it.gmariotti.cardslib.library"/>
您需要将项目的minSdkVersion
更改为14或将it.gmariotti.cardslib.library
的更改为9.因为导入的库的minSdkVersion
为14。