Android application template
Automation scripts for creating Android applications
view on


This repository contains several batch scripts (for Windows) which help automate the creation of Android applications.

The form is approximately based on this tutorial, except it uses a more up-to-date version of the Android tools and provides the steps in script format. These scripts can be modified or merged into something else (such as a python script,) but separate batch scripts is a simple enough starting point.


This will describe the basic order the scripts should be used in, and when source files should be created/added.

  1. Get the JDK and the Android SDK
    There are two prerequisites that are necessary:
    JDK - for Java compilation and tools
    Android SDK - for everything Android related (this example uses the standalone version)
    Remember where you install them.
  2. Edit settings.bat
    Edit settings inside this file which will be changed for your project. Examples include:
    DIR_JDK (path to the JDK you installed)
    DIR_ANDROID (path to the Android SDK you installed)
    PROJECT_NAME (a unique name for your project; this is also used to create the device)
    DOCUMENTATION_TITLE (a title for the documentation)
    DEVICE_* (use "%DIR_ANDROID%\tools\android" list target to show available device targets)
    KEYSTORE_* (you may also want to remove/clear any password settings)
  3. Run init.bat
    Creates all directories that will be used in the project.
  4. Run create-device.bat
    Creates a virtual device in the .android directory.
  5. Run create-keystore.bat
    Creates a file to store public/private keys used for signing.
  6. Edit AndroidManifest.xml
    Modify any paths, variable names, or anything else for the project.
  7. Create source code files and resource files
    Create any code and resources your project needs to run.
  8. Run create-R.bat
    Creates the Android resource file, used for locating any resources you create.
  9. Run compile.bat
    Compiles your project using Java.
  10. Run create-dex.bat
    Compiles into Android usable bytecode.
  11. Run create-apk-unsigned.bat
    Creates an unsigned Android package.
  12. Run create-apk-signed.bat
    Creates a signed Android package using the keystore.
  13. Run create-apk-final.bat
    Creates a zipalign'd version of the Android package, providing some optimization.

To run and install in an Android emulator, use the following commands:

  1. Run start-emulator.bat
    Starts the emulator.
  2. Run install-in-emulator.bat while the emulator is running
    Installs the application onto the virtual device. May need some editing depending on how source code directories are set up.

The following miscellaneous scripts are also available:

  1. Run uninstall-in-emulator.bat while the emulator is running
    Uninstalls the application from the virtual device. May also need some editing.
  2. Run install-on-device.bat
    Installs the application onto a real plugged in device.
  3. Run delete-device.bat
    Cleanly deletes the created virtual device.

Note: emulation can be sped up if you have an Intel processor and install their Hardware Accelerated Execution Manager.
The installer may also be found in the following directory depending on which components you chose to install: