Version 0.2
Copyright © 2011 Lars Vogel
28.02.2012
| Revision History | ||
|---|---|---|
| Revision 0.1 | 24.08.2011 | Lars Vogel |
| Created | ||
| Revision 0.2 | 28.02.2012 | Lars Vogel |
| bugfixes and enhancements | ||
Table of Contents
The Android SDK provides tooling for the command line to create and build Android projects.
The Android Development Tools offer tools for Eclipse to create and build Android applications. In Eclipse you can manually export Android applications via the Eclipse wizard.
To build and deploy Android application the Android SDK provide tools based on Apache Ant. Tooling for building Android Application with Maven are also available.
Building Android outside Eclipse involves using the command line or shell. You should be familiar with using a shell in case you want to be able to perform this tutorial.
Make sure that the
tools
and
platform-tools
folder of the
Android SDK installation
directory are part
of your PATH
environment
variable.
The Eclipse project generation wizard does not create the required Apache Ant build.xml file. You can generated it on the command line.
android update project -p .
Now you can build your project via Apache Ant.
// Clean the project ant clean // Build a debug version ant debug // Builds the debug version // and installs it ant debug install
If you want to release your application you can create the
ant.properties
file in your project directory. In this file you
point to your signing
key and the alias for it.
key.store=path/to/my.keystore key.alias=mykeystore
You can now create a release build.
// Build release ant release
The following assumes that you are familiar with Android development. Please see Android Development Tutorial for an introduction.
This tutorial only covers the Android specific settings of Apache Ant. Please see the Apache Ant Tutorial for an introduction into Apache Ant.
Create a new Android project called "de.vogella.android.build.firstant" with the Eclipse Android project wizard. The created project does not include the Apache Ant "build.xml" file.
Switch to the command line and into the directory which contains you new Android project. Type the following to create your build.xml file.
android update project -p .
Now you can build and deploy your project via Apache Ant.
// Clean the project ant clean // Build a debug version ant debug // Builds the debug version // and installs it ant debug install
You can also start your application via the command line. For this you
use adb shell to send an intent to your
Activity.
adb shell am start -a android.intent.action.MAIN -n de.vogella.android.build.firstant/.MainActivity
Before posting questions, please see the vogella FAQ. If you have questions or find an error in this article please use the www.vogella.com Google Group. I have created a short list how to create good questions which might also help you.
vogella Training Android and Eclipse Training from the vogella team
Android Tutorial Introduction to Android Programming
GWT Tutorial Program in Java and compile to JavaScript and HTML
Eclipse RCP Tutorial Create native applications in Java
JUnit Tutorial Test your application
Git Tutorial Put everything you have under distributed version control system