Sublime-Text 3 for Android Development

February 20, 2014


I recently switched from Eclipse to Android-Studio for my Android development. However, I have found myself less interested in using an IDE as I have fallen in love with Sublime-text 3. So I set out to find the best way that I can use Sublime Text to develop my Android applications. Here is how I have set up my Android development environment.

Generating Project Files

Because Android Studio uses the Gradle build system that is deeply integrated with the IDE, I still have not gotten around using Android Studio to create the build files and project file structure. TO create the base projects, I have been creating a new project in Android Studio using the default project wizard. This is straight forward, so I will lieave that explanation here.

Creating the Sublime-Text Project

Sublime Text Projects are one of my favorite features of the program. To create the project, simply add the root project folder to the proejct and save the project. Saving the project creates a .sublime-project file where some configuration will be made to help make development easier and customized.

Necessary Plug-Ins

For my environment, I make use of a few plug-ins. The most important one that I use is SublimeLinter and SublimeLinter-Javac. This plug in will lint my code and find errors like an IDE would. At the moment, it takes some project level configuration to make it optimal. The classpath and the sourcepath of the proejct must be set in the Sublime Project file in order for the Javac linter to find the necessary symbols and show relevant error. An example of this configuration may be seen here. Eventually, I would like to be able to write a new linter plug in for SublimeLinter to interace the Android linter, but this will have to wait until I have more time. The second pkug-in that I make use of is Sublime ColorPicker. This can be incredibly handy when designing the XML files to design my apps. Finally, the last plug-in is SublimeAndroidImport. This plug-in will parse the current file and automatically add the missing imports from the Android SDK.

Building the Project

The new gradle system makes building the project a lot more simple than the old ant build files. I won't go into setting up the gradle files here though, only using them to build with Sublime-Text. To do this I have created simple build systems for gradle. However, my way of doing this is nowhere near ideal. For now I have made multiple build systems to deal with the different options (Read: Extremely simple). This way I can select the gradle build or install from the build system menu and use Ctrl+B to build the project. Quirks at the moment are that you must be viewing the sublime-project file when building to avoid path errors, and that there is not one exhaustive build system option to build, install or clean the project.

Future improvement

In the future (Read: When I have time) I want to make an exhaustive Android plug-in for Sublime-Text (A la Andrew, only for gradle). As I improve my way of using Sublime-Text, I will update this to show the new steps. For now, this method has worked for me with only a few kinks (Creating the project in Android Studio).



comments powered by Disqus
  • Copyright 2013, Matthew Iannucci
  • Site created with web.py, version 0.3
  • Updated January 2015