Android: Adding a Library which has a different Android Target API

963 views Asked by At

So I found this library: CardsLib which is a very modern and cool interface to implement in android and I followed his instruction given here to add the library to my project. However my main project has a build target API of Android 5.0 (21) and the Cardslib Library has a target of Android 4.0 (14) and when added to my project leaves me a nasty list of errors which are as follows:

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

I tried changing the Build target of the library to Android 5.0 but that didn't help. What do yall suggest please?

1

There are 1 answers

2
Gabriele Mariotti On BEST ANSWER

First of all,you can check all info about target, minSdk and api used to compile here:

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

  • The target of the library is 21 (and not 14)
  • The minSdk is 14
  • The api needed to compile is 21

Now, it is quite difficult to say what is your issue, but this error

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

sounds like you are using an API<16 to compile your project.

The second advice is to use Android Studio (now it is the official IDE) to work with Android in general and with this library.

Just add this line to your dependencies

dependencies {

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