Building for Devices (Android)

Select Open for Build from the File menu, and choose "Android" as the platform at the bottom of the dialog. This generates a standard .apk file. The build process is a little slower than for iPhone, as it is more complex internally.

Note: we have greatly simplified the Android build process, as compared to the Android SDK. In particular, you do not need to install the Android SDK! The entire Android build process can be handled by our servers. However, you do need to provide a suitable certificate for signing. See below for details.

Note: As of daily build 328 (3/24/2011), we are only supporting Android 2.2 and newer devices running the ArmV7 processor. Building for Android 1.5, 1.6, and 2.0 has been deprecated due to a number of limitations in those versions of Android. We are only supporting ArmV7 processor because of the speed improvements from the hardware floating point support.

Signing Your App

In order to Build for Android Device, you will need to sign your application using a different signing process than you use for iPhone. For debug builds, the Corona SDK for OS X includes a "Debug" keystore which you can use to test your apps on devices. To use the Debug keystore, in the Build for Android dialog (File > Build for Android) select Debug from the Keystore pop-up menu, and then select androiddebugkey from the Key Alias pop-up menu.

However, for release builds, you must sign with your private key. You can generate this key using the command line program Keytool. For further information, please review the Android documentation available at: http://developer.android.com/intl/de/guide/publishing/app-signing.html

The version number in this Android build dialog must be an integer. It corresponds to the versionCode item on http://developer.android.com/guide/topics/manifest/manifest-element.html and is not visible to users. (The versionName attribute is the string shown to users).

About Java package names

When you build an Android application 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 of your domain name, e.g. "com.acme", then append the name of a division or product line, and then possibly append the name of a specific app. For example, "com.acme.games.catchafish" would be a good package name, assuming you owned the "acme.com" domain name.

In some cases, the package name that results using reverse-domain naming may not be valid, and must be modified before Corona will build your Android application. 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 (com.three_amigos).
  • One of the package name components starts with a digit or other character not allowed at the beginning of an identifier (com.3amigos, for example). In this case, prefix that part of the package name with an underscore (com._3amigos).
  • Any of the package name components are keywords (com.private.idaho). In this case, prefix that part of the package name with an underscore (com.private_.idaho).

For more information about package names, see Unique Package Names in the Java documentation from Oracle.

Application Icons

Icon files named Icon-hdpi.png, Icon-mdpi.png, and Icon-ldpi.png will be copied into the .apk during the build, if they are available in your project folder. These icons should be created in the standard Android icon sizes (72x72, 48x48, 36x36) and follow the Android Icon Design Guidelines, which are available at http://developer.android.com/intl/de/guide/practices/ui_guidelines/icon_design.html.

If you are building for Android 1.6, your project folder must also contain an icon file named "Icon.png" that is a copy of"Icon-hdpi.png", in addition to the resolution-specific icon image files.

Installing Your App

Method 1: if you have already installed the Android SDK, use adb install your-app.apk.

Method 2: Upload the apk to a web server. Point your Android device's web browser at the file’s URL to download the APK to your phone. Finally, click on the file in the Download History to install it on the phone.

If Method 2 fails, and the phone downloads the application as a textfile instead, you may need to add the following configuration line to an .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, then click "Applications", then check the box next to "Unknown Sources".

Note: to reinstall an app, you may first have to uninstall the previous version of the app. To do this, Click the Settings icon on the device, then choose "Applications", then "Manage Applications", then scroll to the application you wish to uninstall, click on it, and press the "Uninstall" button on the next screen.

Additional Notes

You can use our provided "debug.keystore" for testing, if you have not generated your own. The password is "android". However, for shipping an app to the Android Marketplace, you must use your own keystore.

Android devices have higher resolution than iPhone, and slightly different resolutions among themselves. The Nexus One is 480x800, and the Droid is 480x854. However, you can retarget iPhone-sized content for Android screens with Corona’s content scaling features (see the API Reference). In most cases, iPhone content upscaled to Android looks quite good, since the Android devices have roughly the same physical screen size as the iPhone, despite the higher DPI.

Android does not support the same file formats as iPhone. For example, .caf sound files will not work. We suggest converting them to .mp3 or .ogg. One option to convert them is the SoundConverter utility. .JET audio is not supported yet.

The status bar is not supported on Android. Currently we set all apps to full screen.

Android applications do not use “Default.png” splash screens, or any equivalent.

Differences Between Android and iPhone Device Support

The following features available for iPhone devices are not yet implemented, or fully implemented, for Android device builds:

  • Camera
  • Activity indicator
  • Orientation changes
  • OpenAL audio: limited support

Replies

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fredafal
User offline. Last seen 2 years 1 week ago. Offline
Joined: 19 Jan 2011

What is wrong with building with corona to an Android .apk file, transferring the .apk file to the SD card via the USB interface, and using any number of appinstaller apps to load the built app?

This is how I have been doing it.

Is this method not recommended?

cmj7
User offline. Last seen 1 week 5 days ago. Offline
Joined: 24 Oct 2010

Installing your app -- I suggest Method 3: copy file via Dropbox.

Create a Dropbox.com account. After building, copy the .apk file to a Dropbox folder. On the Android, log into Dropbox, browse to the same folder, and click on the .apk file to download and install it.

Easier for most people than uploading to a web server.

shawnzhang
User offline. Last seen 28 weeks 14 hours ago. Offline
Joined: 15 Feb 2011

How can I use Android Market Public Key?
Thanks.

Ninja Pig Studios
User offline. Last seen 2 days 20 hours ago. Offline
Joined: 26 Jan 2011

Shawnzhange check out my forum topic post. I creat an easy to use 3 step process regarding application signing.

http://developer.anscamobile.com/forum/2011/04/16/signing-android-applications-3-easy-steps

ewing
User offline. Last seen 1 year 20 weeks ago. Offline
Alumni
Joined: 13 Jul 2010

Hi arash.jalalian,

Make sure:
- You are running at least the latest stable release of Corona
- You are installing to a armv7 based device and not an armv5/armv6 device
- You installed the JDK6 and not JDK7 (JDK7 is incompatible with Android)
(see http://developer.anscamobile.com/forum/2011/08/02/installparsefailednocertificates)

ewing
User offline. Last seen 1 year 20 weeks ago. Offline
Alumni
Joined: 13 Jul 2010

Note to everybody: Please post questions in our forums instead of here. You are far more likely to get responses in the forums.

RicardoGraca
User offline. Last seen 2 days 8 hours ago. Offline
Joined: 17 May 2011

Note that with the latest daily build as of today (2012 - 731) it seems that splash screens are indeed supported on Android applications (built with Corona). If there's a Default.png file in the root of the project it will be used as splash screen.