How do I Become an Android Developer on a Mac?
This lesson describes the basic steps you need to follow in order to start up as an Android developer using an Apple Mac. System configuration information and screen captures are provided.
Android is another mobile device family supported by LiveCode. The steps discussed in this lesson outline a process that allows you to set yourself up as a LiveCode developer for the Android platform and successfully build and deploy test applications. The steps are set out in chronological order, first determining the software requirements and then setting up your system.
Note: The screen captures are up to date at the time of writing this lesson.
You will need an Apple Mac that has the following software installed:
Note: It is assumed that you are familiar with the installation process of an Apple operating system and LiveCode. Please make sure these are installed before you commence with the remaining steps of this lesson.
The following steps run you through the software installation process that you would typically follow on a Mac.
Downloading the Android SDK
If you do not have Android SDK installed, then you can download it from: http://developer.android.com/sdk/index.html.
Navigate to the download link that is specific to your hardware platform. You may get the kind of download dialog that is shown in this step. Save the file to your file system.
Executing the Android SDK
The Android SDK files you have downloaded comes in a zip file that contains the Android SDK and AVD Manager. You can install the Android SDK into your development environment by executing the following steps:
1. Use Finder to navigate to the location into which you downloaded the Android SDK zip file.
2. Double click on the file to extract it.
3. Move the extracted package into a location that is to store the Android SDK.
4. Navigate into the package that was moved and locate the file android-sdk-mac_x86/tools/android.
5. Execute android-sdk-mac_x86/tools/android.
Installing the Android SDK Packages
Once you have started the Android SDK and AVD Manager, you need to add the required packages.
1. Choose Installed packages from the left hand panel.
2. Select the Update All... button from the Android SDK and AVD Manager window.
3. The Android Package Installer is launched, with all packages selected by default.
4. Select the Install button to run the package installation.
Verifying the Android SDK and AVD Manager Package Installation
After the Android SDK and AVD Manager has completed installing the selected packages, you should find that a list of packages appears in the Installed packages section.
Note: You should have installed the SDK Platform Android 2.2, API 8, revision 2 package.
Note: There is a known "black screen" issue when deploying certain stacks to a simulator running Android 2.2, API 8 with revision 2 . If you experience this issue please create and use an AVD of Android 2.3 or higher.
Configuring a Virtual Device
Once you have installed the required packages, you can use the Android SDK and AVD Manager to set up a virtual device that can be used in your development environment. This allows you to test your applications without requiring a physical Android device. You can set up a virtual device as follows:
1. Make sure the Android SDK and AVD Manager is running.
2. Choose Virtual devices from the left hand panel.
3. Select New... .
4. Choose the Name for your virtual device.
5. Set the Target to at least Android 2.2 - API Level 8.
6. Fill in the SD Card Size.
7. Optionally enable Snapshot. This speeds up the launch of the emulator.
8. Select Create AVD.
Starting the Virtual Device Simulator
You can launch the emulator by highlighting the virtual device you created and selecting Start... .
Configuring a Physical Device
In addition to setting up virtual devices, it is possible to set up physical devices. These devices can be accessed after they have been appropriately configured for debugging. The relevant device must be set to debug mode:
1. Go to the home screen, and select MENU.
2. Select Applications -> Development and enable USB debugging.
3. Connect the device via USB to your development machine.
4. The device should now be available and accessible from the Development -> Test Target menu in the LiveCode IDE.
Configuring LiveCode for Android Support
By now, you should have successfully installed the required software in you development environment. The next step is to launch LiveCode and configure it to interface with the Android SDK.
Launch the LiveCode IDE and select LiveCode -> Preferences to launch the Preferences menu. Then select Mobile Support and you are presented with the dialog shown in this step.
This dialog allows you to configure the path to the Android SDK root, which you should already have installed. Select ... under Android SDK and choose the directory containing the Android SDK root.
Validation checks are made once you specify the location of the Android SDK root. This ensures that you have selected a valid location and have the required Android components installed.
The following error message may be raised if something is wrong with your set up:
The chosen folder is not a valid Android SDK. Please ensure you have installed it correctly, and enabled support for Android 2.2 (Froyo).
This indicates that the path you specified is not pointing at the Android SDK root. You may have to navigate one level deeper into the directory hierarchy to access the root directory. The root directory may look something like: ...android-sdk-mac_x86.
The Standalone Application Settings... Window
Select File -> Standalone Application Settings... from the LiveCode IDE. Then choose Android from the list of deployment options. This raises the Standalone Application Settings dialog for Android specific builds.
You can make a stack build for Android by selecting the Build for Android tick box and configure any other options you wish to include.
You can select the name of your application using the General option at the top of the pane and add files to your build by using the CopyFiles option at the top of the pane.
Note: Making a stack build for Android disables building standalone mainstacks for any other non-mobile platforms. If you wish to share code and rescues among platforms, factor you application into multiple stacks, using a different mainstack for mobile and desktop targets.
Note: Inclusions, Copy Referenced Files, Bug Reports and Stacks features are not available when building for Android. Use the CopyFiles feature if you wish to include multiple stack files in your application.
Running Under Android
You should now have set up your development environment for Android and are ready to test a LiveCode application on an Android device.
Ensure the emulator is running or and adequately configured physical device is connected before trying to test your code. Then select a device from the LiveCode IDE from Development -> Test Target. Your Test icon on the main pain of the LiveCode IDE should now be active and allow you to deploy your LiveCode application.
Depending on how experienced you are with LiveCode, you may want to review more of the numerous lessons and tutorials we have on developing for Android, iOS and broader lessons that explore the general concepts behind LiveCode. The release notes accompanying LiveCode releases with Android platform support provide up to date development information and give you an overview of the features that you can access via LiveCode.