DevCorner: Sharing Run Configurations in Android Studio

DevCorner is where we talk about all things software development-related from inside TechSmith. This is the place for interviews with our devs, source code samples, and an inside peek at some of the cool stuff we’re working on…


Android Studio is built from a fork of IntelliJ (a popular Java IDE). Much like Eclipse, IntelliJ uses a series of workspace and project files to keep things organized for you between runs of the IDE. For the most part these files are personalized and should, in large part be ignored in your version control system.


Gradle is Android’s new build system and uses a scripting variant of Java called Groovy to define dependencies and tasks. What’s special about using Gradle along with Android Studio is that it is capable of defining all the dependencies and project structure for both IDE and headless (build server) builds, so you no longer have to maintain a project file in Eclipse as well as write custom scripts to build all your projects in the correct order for headless builds.

Example Project Structure

include ':libs:xl-image_utils_lib-android:xl_image_utils_lib'
include ':AndroidEye'
include ':apps:CoachsEye_Free'
// ':' means folder so for example the AndroidCloudSDK will use
// $/libs/android-cloud-sdk/AndroidCloudSDK/build.gradle to compile
include ':libs:android-cloud-sdk:AndroidCloudSDK'
include ':libs:android-video-library:AndroidVideoLibrary'
include ':libs:android-utilities:WidgetLibrary'
include ':libs:Android-PullToRefresh:library'
include ':libs:android-cloud-sdk:JavaCloudSDKTest'
include ':libs:android-utilities:AndroidUtilities'
include ':libs:android-video-library:StagefrightInterfaceLibrary'
include ':libs:android-video-library:AndroidCameraLibrary'
// If a module's build.gradle applies the 'android' plugin
// it is listed as a runnable application
include ':apps:Cyclops-Team'
include ':libs:CastCompanionLibrary-android'
include ':libs:android-cloud-sdk:JavaCloudSDK'
include ':libs:facebook-android-sdk:facebook'
include ':libs:uservoice-android-sdk:UserVoiceSDK'

Tasks/Run Configurations

Much like Ant builds, Gradle uses a series of named tasks to indicate what should be built from your project. For example, using the android plugin you’re likely to have tasks that reference each of your app’s build targets ‘:apps:CoachsEye_Free:assembleDebug’ for example. In Android Studio, clicking the ‘run’ button automatically assembles the default task for your project (which usually just compiles all the modules Gradle is aware of) and runs the APK for whatever app was selected.

Recently, the Coach’s Eye team has been exploring customizing the set of build steps executed when running through Android Studio and ran into the problem of keeping them synchronized across our team. Remember those user specific workspace settings I mentioned in IntelliJ earlier? Turns out by checking this box:


a run configuration file is generated under ‘$/.idea/runConfigurations/’ that can safely be shared between teammates. What’s even better is that when a new teammate clones your repository and opens the project for the first time in Android Studio, the checked in version of your custom run configuration will automatically pre-populate for them.