UPDATE: Read Version 2 for more detailed instructions.
Creating an app directly from its source code and installing it on a device can often seem like a daunting task. Take a look at how we make our Android applications with a few easy steps in the command line!
- Latest Android SDK
- Latest JAVA JDK
- Apache ANT
If you don’t have Ant, you can obtain it from the Apache Ant home page. Install it and make sure it is in your executable PATH. Before calling Ant, you need to declare the JAVA_HOME environment variable to specify the path to where the JDK is installed.
Also set the PATH to Android SDK
Pre Build Config:
- Checkout the Latest Code from SVN
- Navigate to Checkout Directory using Command Line (Terminal)
- Enter the following command:
android update project -p <PATH TO CHKOUT DIR> -t "Google Inc.:Google APIs:<LEVEL Number>" -n <name that will appear in device>
- To make sure everything is in place, type
ant clean. This will make sure
build.xmlis proper and all the required tools are in place.
There are two ways to build your application using the Ant build script: one for testing/debugging your application — debug mode — and one for building your final package for release — release mode.
We will make Release Mode build as its the actual file that we send out for QA and end users.
Building in Release Mode
When you’re ready to release and distribute your application to end-users, you must build your application in release mode. Once you have built it in release mode, it’s a good idea to perform additional testing and debugging with the final
.apk. Never publish an updated build to the Google Play store.
To build in release mode:
- Open a command-line and navigate to the root of your project directory.
- Use Ant to compile your project in debug mode:
This creates your release
.apk file inside the project bin/ directory, named
<name of project>-release.apk.
Installing the App on your Android Device or in the Emulator
<name of project>-release.apk is created you can install it on your Device or Emulator, to do so follow the below steps:
- Start the desired Emulator or Connect the Development Device
- Navigate to
/bindirectory in your Project.
adb install <name of project>-release.apkin the command line.
- This will install the apk in Emulator or Device directly.