It was recently requested that I show how to create an Android app from start to finish using a text editor and command line. Although the process isn’t difficult, it might not be so straight forward for a first time developer. The scope of this article should cover the following:
This example assumes that you have already downloaded the Android SDK and installed it. In addition to having the SDK, it is a requirement to have installed Android API 14 (4.0.0) as you will need that for building. Although there are many ways to work with Android, we will be using Apache Ant for building our application.
Using your command prompt, we will be creating a project as explained in the Android documentation:
android create project \
--target <target_ID> \
--name <your_project_name> \
--path path/to/your/project \
--activity <your_activity_name> \
--package <your_package_namespace>
To keep consistency with this tutorial, let’s create our project like the following:
android create project --target 14 --name ExampleProject --path ./ExampleProject --activity ExampleActivity --package com.nraboy.exampleproject
This should create a fresh Android project for 4.0.0 (Ice Cream Sandwich) targets.
Using your terminal, we will be creating a keystore for signing your app like explained in the Android documentation:
keytool -genkey -v -keystore my-release-key.keystore
-alias alias_name -keyalg RSA -keysize 2048 -validity 10000
After entering the command, you will be prompted with a set of questions. Answer them to the best of your ability. Leaving a field as unknown shouldn’t cause any negative impact when signing your apps. It is very important that you do not lose this keystore and that you remember your password to the keystore. Once you sign an app with it, the only way to update the app is with the same keystore. Losing it will render you in big trouble.
Now that you’ve got your keystore, there are a few things that must be done in order to use it in your build process. Go ahead and copy it into your Android project at the root and then crack open the ant.properties file. If it doesn’t exist, create it. Assuming you’ve been copying what I’ve done so far, add the following two lines to the file:
key.store=exampleproject.keystore
key.alias=exampleproject
Now when you try to create a release build, Ant will use your keystore to sign it. You will be prompted for your keystore password two times during this build process.
ant release
Running the above will start the release build process leaving you with an APK to submit to the app store. The file will be named something like ExampleProject-release.apk not to be confused with the many other APK files made in the build process.
Releasing your app to the world should be a breeze at this point, but there are a few things you should already have ready before you proceed:
There are other items that will contribute to the success of your application but those are the bare essentials.
When you’re ready, navigate to the Google Play Developer Console and choose to add a new application. This should bring up a screen asking for the application title and options to either upload your release APK file now or just create a draft for a store listing:
Because I like to make sure everything is perfect first, I prepare the store listing before I upload the APK file.
Go through the list and populate your listing with the appropriate content. Most of the fields are not required, but the more complete you make your listing, the better app store optimization (ASO) will come out of it. I strongly recommend you fill out everything if you want your application to have a good start.
When you submit your Android app for release, it usually takes a few hours to show up in Google Play. There is no review process with Google Play, you are only waiting for it to be crawled.
A video version of this article can be seen below.