Introduction

This tutorial will explain how to get set up with a new Android project capable of interacting and extending JuiceSSH as a plugin. We will discover the necessary software requirements, how to build a new Android project and then how to include our Plugin Library.

Once you have a JuiceSSH Plugin capable app project, you will then be able to follow one of our example app tutorials or add your own functionality for you to then compile and publish on the Google Play Store. The example app tutorials have been designed to give a good overview of the capability of plugins.

If you're already an experienced Android developer, you may wish to skip straight to Including the JuiceSSH Plugin SDK and then go on to the Example App Tutorials.

Your Development Environment
In this tutorial we will refer to your development environment. By this we mean an easily accessible directory solely used for Android development. ~/dev is a good example which we ourselves often use (which is equivalent to $HOME\dev for Windows users).

Installing Android Development Requirements
Before you can write any Android apps, you must download the appropriate tools such as the Android SDK and Android Studio. The best place to do so is The Android Developer Centre, where you can also find other, very well written, Android Development materials. We'll explain briefly how to get the tools set up, but really the Android Developer Centre will say it much better than we do with far greater detail.

First we need to download and install the Android SDK. Once completely installed, it will include:

  • The most recent Android builds
  • A device connectivity tool, ADB
  • Plenty of debugging tools like DDMS
  • Various reference resources such as icons


Once downloaded, you should extract the contents to a directory called sdk within your development environment. The base SDK available for download is initially limited mostly to a few core tools. You will need to start the package manager and install some extra packages to provide all the functionality we need. To do so, run the application ~/dev/sdk/tools/android. You will need
  • Android SDK Platform-tools
  • Android SDK Build-tools
  • Android Support 
  • All Android 4.3 libraries
The version of Android that you opt for is of course up to you. We've selected 4.3 as, at time of writing, it's supported by a fast and handy x86 emulator; Genymotion.

Finally, we're ready to install our IDE: Android Studio.

Creating a New Android Project
Once ADT and Android Studio are installed, you can now create a new project which will become your JuiceSSH Plugin App. Start by opening Android Studio and selecting New Project. Follow the wizard to apply basic naming and appearance options.



Including the JuiceSSH Plugin SDK

Your project should contain a build.gradle file used for defining compiler instructions. This is where we will add the JuiceSSH maven repository and specify the plugin library as a dependency. Do so by adding the line

    maven { url 'https://raw.github.com/Sonelli/maven/master' }

to the repositories section and then

    compile 'com.sonelli:juicessh-pluginlibrary:1.0.+@aar'

to the dependencies section.


Test

After hitting the Sync Project with Gradle Files button, you should be able to start referencing classes such as PluginContract from the com.sonelli.juicessh.pluginlibrary package within your code.