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.
Icon files named
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.
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:
- Activity indicator
- Orientation changes
- OpenAL audio: limited support