Using ShinobiCharts with Android Studio 1.0Posted on 11 Dec 2014 Written by Joel Magee
Android Studio has finally come out of Beta and we here at ShinobiControls are very excited to be getting our hands on a stable release. We have plans in place to release ShinobiCharts for Android as an .aar file, but for the meantime we will use our tried and tested methods for installing the library. Thankfully, with regards to importing and using the ShinobiCharts library in Android Studio, a lot of what was mentioned in this previous blog post is still relevant.
In this post I’m going to attempt to summarise the instructions provided in that post as a quick reference point and expand upon it by explaining how we can also incorporate the ShinobiCharts Javadocs into Android Studio.
Import ShinobiCharts Library Quick Reference
- Firstly, within your project, go to File > Import Module, select the downloaded shinobicharts-android-library folder and follow the import wizard leaving the values as default
- Edit the shinobicharts-android-library build.gradle file to change the apply plugin line to read:
apply plugin: 'com.android.library'and remove the
applicationId "com.shinobicontrols.charts"line from the defaultConfig section
- Right-click on your app folder and select Open Module Settings
- Choose the Dependencies tab, click the +, select Module Dependency and then select :shinobichartsandroidlibrary to add the ShinobiCharts library to your project
- Finally make sure you have
android:hardwareAccelerated="true"added in the application section in your app Android Manifest – this is required for certain devices
Importing the Javadoc files
In Eclipse it’s possible to view the Javadocs of a library in the editor and Android Studio is no different. Placing the cursor over a class or method and pressing
Ctrl + Q (
F1 on Mac) will open the relating documentation.
Importing ShinobiCharts for Android alone won’t import the javadocs as you can see in the image above. In order to display the Javadocs we need to edit one more file. Within your project directory navigate to the
.idea/libraries folder and open the xml file which should be in the format
You should be able to see that the classes for the library have been paired with their corresponding jar file but the Javadoc section is empty. All you need to do is replace the appropriate line with the following:
<JAVADOC> <root url="file://$PROJECT_DIR$/shinobichartsandroidlibrary/src/main/assets/docs/reference/" /> </JAVADOC>
Finally sync your project files by pressing
Ctrl + Alt + Y (
Cmd + Alt + Y on Mac) and you are done! You should now be able to go back to your code and, using the shortcut we used earlier, view the ShinobiCharts Javadocs.
Tip: Using the shortcut
Shift + F1(same on Mac) or pressing the up arrow in the documentation frame will open up the full Javadocs in your browser.
Warning: If at any point you sync your project with the Gradle files then the xml file will be overwritten! It is therefore best to do this step after you have successfully imported the ShinobiCharts library.
Now that Android Studio has been released, another stable environment is available for developers that wish to develop apps for Android devices. While we, like many of you, are still in the process of migrating over, this post describes how it is possible to set up Android Studio to test out ShinobiCharts for Android.
JoelBack to Blog