Import the shinobigrids Library

Android Studio

To use the shinobigrids library you’ll need to declare a dependency on it from your application. This section covers both the process of importing the library from a locally stored .aar file and importing the library from a private repository.

From a locally stored .aar file

Open up Android Studio and make sure you’ve unzipped the download bundle. This guide assumes that you have already created a project for your application within Android Studio.

  1. With your project open within Android Studio, click File > New > New Module…. In the Create New Module window that appears, in the lower panel click on Import .JAR or .AAR Package. With Import .JAR or .AAR Package highlighted, click Next.
  2. Click the ellipsis button (…) and browse to the directory in which you unzipped the download bundle. Locate the shinobi-grids-android-1.0.0-0.aar. Click Finish.
  3. You should now see a new module within your project which represents the imported shinobigrids Library. You must now include a reference to the library in your project’s dependencies.
  4. Click File > Project Structure…. In the Project Stucture window, on the left hand side click on your application module (usually called app). With this selected, click the Dependencies tab.
  5. Click the plus (+) symbol at the right side of the window and choose Module Dependency. From the drop down list select the entry for the new library module which you created in the previous steps and click OK.
  6. As the ShinobiGridView makes use of Android’s RecyclerView you must also add a dependency to the library that contains it. Click the plus (+) symbol again but this time choose Library Dependency.
  7. Type recycle and press the search button (the magnifying glass). Select the entry that says com.android.support:recyclerview-v7:22.2.1 and click OK.
  8. Click OK again to close the Project Structure window. This should automatically trigger a Gradle build of your project.
  9. You should now be able to reference the shinobigrids library within your application project.

From a private repository

This section of the guide assumes that you have already created a project for your application within Android Studio. It also assumes that you have declared the repository (where the shinobigrids library will reside) within your project’s master gradle.build file.

When installing/deploying the .aar file to a Maven repository you can use the provided pom.xml file (also in the ‘lib’ folder of the download bundle). This will declare a dependency on the library containing Android’s RecyclerView, which the ShinobiGridView makes use of. It will also set the following:

  • groupId: com.shinobicontrols.android.grids
  • artifactId: shinobicontrols-android-grids-<edition>-java
  • version: 1.0.0-0
  • packaging: aar

To add a dependency to your application on the shinobigrids library, which resides in your repository:

  1. Open the build.gradle file of your application’s module
  2. In the dependencies section, add a dependency to shinobigrids for the compile configuration using the groupId, artifactId and version that you set when installing the .aar file. If you used the provided pom.xml file you would do the following:

    dependencies {
        compile 'com.shinobicontrols.android.grids:shinobicontrols-android-grids-<edition>-java:1.0.0-0'
    }
    
  3. Sync your project with the Gradle files by clicking on the Sync Now link or on the Sync Project with Gradle Files button

  4. You should now be able to reference the shinobigrids library within your application project.

Important: if you did not use the provided pom.xml file when installing the shinobigrids library into your repository, you will also need to add a dependency on the library containing Android's RecyclerView to your application's build.gradle file:

dependencies {
    compile 'com.shinobicontrols.grids.android:shinobi-grids-android:1.0.0-0'
    compile 'com.android.support:recyclerview-v7:22.2.1'
}