This guide explains how to sign, build, and test your app on Android devices.
You do not need to install the Android SDK. However, you will need to install the x86 (32-bit) version of the Java 6 Development Kit if you're using Windows. Corona does not support JDK7. See Java Development Kit Setup for details.
The Android build process generates a standard .apk file. You can build and test apps on Android devices without creating a Google developer account, but you will need an account if you wish to publish to the Google Play marketplace.
We only support Android devices that run Android 2.3.3 or higher with an ARMv7 processor. This can create some confusion because ARM processors are identified by both a family and an architecture. Family names do not have a "v" in them. For instance, the ARM7 processor is actually a ARMv3 architecture, and ARM11 is a ARMv6 architecture. See this guide to help identify the various processors.
When you build an Android app using Corona, you must specify a package name. In general, you can specify any package name you like, but it must be chosen carefully because it should be unique to your application.
The traditional Java scheme is to use the reverse-domain format like
com.acme, then append the name of a division/product, and finally append the name of the app. For example,
com.acme.games.catchafish would be a good package name, assuming you own the
acme.com domain name.
In some cases, the package name that results from using reverse-domain format may not be valid, and it must be modified before Corona will build your Android app. This would be true in any of the following cases:
The package name contains a hyphen or other special character (
com.three-amigos for example). In this case, convert the special character to an underscore:
One of the name components contains a digit or other invalid character at the beginning of an identifier (
com.3amigos for example). In this case, prefix that part of the package name with an underscore:
One of the name components contains a keyword (
com.private.idaho for example). In this case, prefix that part of the package name with an underscore:
If you aren't familiar with the available build settings for an app, please review them before proceeding with this section.
From the Corona Simulator, select File → Open... to load the project you wish to build.
Select File → Build → Android....
Fill in the information:
Application name — by default, this will match your project folder; keep this name or specify another.
Version Code — this value must be an integer. Each time you update your app, you must increase the Version Code. It corresponds to the
versionCode item detailed here. It is not visible to users.
Version Name — specify a version name for your app.
Package — see Java Package Name above.
Minimum SDK Version — Android 2.2 is available at this time.
Target App Store — select Google Play from the pull-down list.
Save to folder — specify where to save the compiled app.
Click Build and Corona will compile the app into a standard .apk file.
For debug builds, Corona includes a
debug.keystore for testing your app on devices. To use it, follow these steps:
Select Debug from the Keystore menu.
Directly to the right, Browse... to the keystore file in the Corona SDK application folder:
CoronaSDK / Resource Library / Android / debug.keystore
Select the file and enter android as the password.
In the Key Alias menu, select androiddebugkey.
For release builds, you must sign with your private key. You can generate this key using the command line program Keytool. Please review the Android documentation here or follow these simple steps:
Open the Command Prompt (Run/Cmd) in Windows or the Terminal in Mac OS X. Once there, use the
cd command to change to the directory where you'll keep your keystores.
Type the following command at the prompt, replacing
mykeystore with the name of your application and
aliasname with a similar or equal alias name.
keytool -genkey -v -keystore mykeystore.keystore -alias aliasname -keyalg RSA -validity 999999
You'll be prompted for your credentials. Supply the requested information and tap enter to sign your Android app.
There are three methods to install an app on an Android device. You can not simply copy the .apk file over to the device.
If you have already installed the Android SDK, use
adb install -r your-app.apk.
Upload the .apk to a web server. Next, point your Android device's web browser to the file's URL to download the app to the device. Finally, click on the file in the Download History to install it.
If this method fails, and the application downloads as a text file, you may need to add the following configuration line to a
.htaccess file in the application's directory on the web server:
AddType application/vnd.android.package-archive .apk
Also, you should set your device to install non-Market applications if you are using
debug.keystore. Click the Settings icon on the device, select Applications, then check the box next to Unknown Sources.
Obtain an app installer from Google Play to assist with the process.
Google's Android SDK provides a set of tools known as Android Debug Bridge or adb. These tools let you look at the device's console log, install, and replace existing apps on your device. You can execute the
adb command from the Mac's Terminal or from Window's Command Prompt. A GUI tool known as ddms is also installed; it can be used to examine the log file and capture screen shots from your device.
These tools are installed as part of the Android SDK. Simply follow these steps:
Download — visit the download page. Instead of clicking the large download button, click on the DOWNLOAD FOR OTHER PLATFORMS link. In the second menu (SDK Tools Only) select the correct option for your computer.
Install — on Windows, run the installer; on Mac, unzip the file and move the folder to a sensible location.
Add Tools — follow the instructions for Adding Platforms and Packages. Install at least the Android SDK Tools and Android SDK platform-tools.