3.5 KiB
How to Set Up an Android Development Environment
If you'd like to contribute to the Android project, but do not currently have a development environment setup, follow the instructions in this guide.
Prerequisites
- A Linux VM or host, or a Mac.
- JDK 7 for your platform.
- CMake
- Android NDK
- Android Studio OR
- Android SDK Tools (for command-line usage)
If you downloaded Android Studio, extract it and then see Setting up Android Studio.
If you instead chose to download the commoand-line SDK tools, see Setting up the SDK Tools.
Setting up Android Studio
- Launch Android Studio, which will start a first-launch wizard.
- Choose a custom installation.
- If offered a choice of themes, select your preference.
- When offered a choice of components, uncheck the "Android Virtual Device" option.
- Accept all licenses, and click Finish. Android Studio will download the SDK Tools package automatically. (Ubuntu users, if you get an error running the
mksdcard
tool, make sure thelib32stdc++6
package is installed.) - At the Android Studio welcome screen, click "Configure", then "SDK Manager".
- Use the SDK Manager to get necessary dependencies, as described in Getting Dependencies.
- When done, follow the steps in Readme.md to compile and deploy the application.
Setting up the SDK Tools
- In
Source/Android
, create a file calledlocal.properties
. - Add a single line:
sdk.dir=<sdk-path>
, where<sdk-path>
is the path where you extracted the SDK Tools package. - Follow the steps in Readme.md to compile and deploy the application.
Executing Gradle Tasks
In Android Studio, you can find a list of possible Gradle tasks in a tray at the top right of the screen:
Double clicking any of these tasks will execute it, and also add it to a short list in the main toolbar:
Clicking the green triangle next to this list will execute the currently selected task.
For command-line users, any task may be executed with Source/Android/gradlew <task-name>
.
Getting Dependencies
Most dependencies for the Android project are supplied by Gradle automatically. However, Android platform libraries (and a few Google-supplied supplementary libraries) must be downloaded through the Android package manager.
- Launch the Android SDK Manager from the commandline by executing
<sdk-path>/tools/android
, or by clicking on its icon in Android Studio's main toolbar: - At the bottom of the window, click "Deselect All", and then "Updates".
- Install or update the following packages:
- SDK Platform, under "Android 5.0.1 (API 21)". This will allow compiling apps that target Lollipop.
- Android Support Repository
- Android Support Library
- Google Repository
In the future, if the project targets a newer version of Android, or use newer versions of the tools/build-tools packages, it will be necessary to use this tool to download updates.