Building

Nicolas Faralli edited this page Jan 5, 2016 · 2 revisions

How to compile, debug, and release Ringdroid.

This page is for developers. You should have some Java experience and an interest in learning the Android SDK before proceeding. You do not need to own an Android-compatible mobile phone in order to develop; Ringdroid works perfectly on the emulator that's included with the SDK.

To play with Ringdroid on the Emulator if you're not a developer, see Emulator.

Install the Android SDK

First, download the Android SDK from this location:

https://developer.android.com/sdk/index.html

Option 1: Gradle

There are two ways to build Android applications: using Gradle (a command-line tool, similar to working with a Makefile) or using Android Studio (a full graphical IDE). The instructions for Gradle are here; for Android Studio, see below.

If you choose to use Gradle, you need to have an environment variable JAVA_HOME pointing to your Java SDK and another one ANDROID_HOME pointing to your Android SDK.

To build, just run:

./gradlew build

This will generate a debug Android package (.apk) file in the "./app/build/outputs/apk/" directory, which you can install on an Android emulator or on an actual handset. Ringdroid won't work without an SD Card, so you should make sure that you create an SD Card disk image if you're going to try Ringdroid with an emulator (for information on how to run the emulator and set up an SD card, see: http://developer.android.com/tools/help/emulator.html).

Once your emulator is running, use this command to install the debug APK on your emulator:

adb install -r ./app/build/outputs/apk/app-debug.apk

This same command works if you have a handset attached via USB. Use the "-d" and "-e" commands to direct an install to the device or emulator, respectively.

Option 2: Android Studio

You can download Android Studio here: https://developer.android.com/sdk/index.html.

Once you have Android Studio up and running, you can import the Ringdroid project using "Import project (Eclipse ADT, Gradle, etc.)" or File -> New -> Import Project... Then select build.gradle (the one in the root directory, not app/build.gradle).

Now you can start the app by clicking on the Run icon, or Run -> Run 'app'. This will build and install Ringdroid on the connected device.

Release

For development team members only:

http://developer.android.com/tools/publishing/app-signing.html

You can either modify app/build.gradle as explained in the Signing in Release Mode section. Or you can create the signed APK using Android Studio: Go to Build -> Generate Signed APK... Select the "app" module, enter the path to the keystore and the passwords, and then choose the destination folder before clicking on Finish.

The initial key was generated with:

keytool -genkey -keystore ringdroid.keystore -alias ringdroid -validity 10000