-1

所以我找到了这个库:CardsLib,它是一个非常现代且很酷的接口,可以在 android 中实现,我按照他在此处给出的说明将该库添加到我的项目中。然而,我的主项目有一个 Android 5.0 (21) 的构建目标 API,而 Cardslib 库有一个 Android 4.0 (14) 的目标,当添加到我的项目中时,我会留下一个令人讨厌的错误列表,如下所示:

G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values\styles.xml:23: error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.
    G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values-v16\styles.xml:22: error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.
    G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values-v16\styles.xml:23: error: Error: No resource found that matches the given name: attr 'android:fontFamily'.
     G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values\styles.xml:34: error: Error retrieving parent for item: No resource found that matches the given name 'card.native.content_outer_layout'.
    G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values\styles.xml:48: error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.
    G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values\styles.xml:55: error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.

    G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values\styles.xml:64: error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.

    G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values\styles.xml:23: error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.

    G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values-v16\styles.xml:22: error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.

    G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values\styles.xml:34: error: Error retrieving parent for item: No resource found that matches the given name 'card.native.content_outer_layout'.

    G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values\styles.xml:48: error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.

    G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values\styles.xml:55: error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.
     G:\UI Kit\Android Sample Projects\cardslib-master\cardslib-master\library-cards\src\main\res\values\styles.xml:64: error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.

我尝试将库的 Build 目标更改为 Android 5.0,但这并没有帮助。请问你们有什么建议?

4

1 回答 1

0

首先,您可以在此处查看有关用于编译的目标、minSdk 和 api 的所有信息:

https://github.com/gabrielemariotti/cardslib/blob/master/library-core/build.gradle

  • 库的目标是 21(而不是 14)
  • minSdk 为 14
  • 编译需要的api是21

现在,很难说你的问题是什么,但是这个错误

No resource found that matches the given name: attr 'android:fontFamily'

听起来您正在使用 API<16 来编译您的项目。

第二个建议是使用 Android Studio(现在它是官方 IDE)与 Android 和这个库一起工作。

只需将此行添加到您的依赖项

dependencies {

    //Core card library
    compile 'com.github.gabrielemariotti.cards:cardslib-core:2.0.1'
}
于 2014-12-24T10:25:33.270 回答