How do I Become an Android Developer on a Mac?

The most recent version of the Android SDK tools do not work with LiveCode. If you are using LiveCode 8.1.5 or later please install Android Studio as described in this lesson.

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.

Introduction

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.

Software Requirements

You will need an Apple Mac that has the following software installed:

- Latest version of LiveCode

- Java SDK (JDK)

- Android SDK (recommend SDK tools only)

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 Java SDK (JDK)

Downloading Java SDK (JDK)

Newer versions of MacOSX do not come pre-installed with the required JDK. You can download it from: http://www.oracle.com/technetwork/java/javase/downloads/index.html.

This link takes you to a landing page for a number of Java specific downloads. You should download the JDK. This can be accessed by selecting the download "JDK" option on this page

Navigate to the download link that is specific to your operating system and select the download link. You may get the kind of download dialog that is shown in this step. Save the file to your file system, execute it and follow the installation steps that guide you through the installation.

Note: You may get a warning dialog if you try to install Java SDK over a previously installed version. The dialog should allow you to reinstall the software, if you would like to do so.

Downloading the Android SDK

Downloading the Android SDK

If you do not have Android SDK installed, then you can download it from: https://developer.android.com/studio/index.html

Navigate to the SDK Tools only 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.

The current version of the SDK Tools is not compatible with LiveCode. Please download version 24.4.1.

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/tools/android.

5. Run android-sdk-mac/tools/android.

Installing the Android SDK Packages

Installing the Android SDK Packages

The main dialog, shown in the figure of this step, is the Android SDK manager.

The Android Package Installer lets you select the packages you would like to install in you Android development environment. By default, only a few pacakges are selected. From this version of the SDK I would recommend keeping the default selection.

Please make sure that you also have checked the latest "Android SDK Tools" and "Android SDK Platform-Tools" from the "Tools" dropdown

Note: Very old versions of Android are not supported and the very latest versions of Android may not be supported until LiveCode has been updated.

Ensure that you install the SDK Platform Android 4.0.3 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 newer Android revision AVD (e.g. 4.1)

 

 

Accept Licence Agreement for each package

Accept Licence Agreement for each package

You will now need to accept the licence agreements for each package

1) Select the package from this left hand window

2) Select the "Accept Licence" checkbox

3) Select the "Install" button

 

Configuring a Virtual Device

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. Select Manage AVDs from the Androids SDK Manages Tools window

2. Choose "New" from the  AVD Device manager window

3. Choose the Name for your virtual device.

4. Set the Target an installed Android API.

5. Fill in the SD Card Size.

6. Optionally enable Snapshot. This speeds up the launch of the emulator.

7. Select Create AVD.

 

Starting the Virtual Device Simulator

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.

Install the appropriate device drivers for the devices you would like to use. Details of how to do this can be found at the Android Developer Website.

The relevant device must be set to debug mode, once the necessary drivers are installed. To enable debug mode, please see your manufactures recommend instructions for doing so. An example for a Galaxy S3 running Android 4.1.1 is-

1) Go to Settings> About> Software Information> More

2. Now Scroll onto Build Number and tap it 7 times repeatedly. After tapping the build number 5 times you’ll see a message “Press it two more times to be a developer!” and after tapping 7 times you’ll see message “You are now a developer” or “Developer mode has been enabled”

3) Navigate to Settings> Developer options

4) Check option for Android Debugging

Configuring LiveCode for Android Support

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). (see Installing the Android SDK Packages step)

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.

The Standalone Application Settings... Window

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.

NB When deploying to a device, you may receive a "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES" message. All this means is that there is currently an application installed on your device that has the same identifier as the app your are trying to deploy. This can happen if you are working on a specific app across multiple development machines.

To resolve this issue you can do one of the following-

-remove the existing application from the device you are deploying too

-change the app identifier in the standalone applications settings

Further Reading

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.

25 Comments

Greggory DeVore

When I select the directory for the Android SDK I receive an error message.
Click the following link to see the images and error message.
http://screensteps.me/grdevore/jcknhq

Please advise.
Dr. DeVore

Michael McCreary

Hi

The latest updates to the Android SDK have shuffled around some of the files causing LiveCode's detection routines to fail. This issue has been resolved in LiveCode versions 4.6.4 and later. In order to work around this in versions 4.6.3 and earlier you need to:

1) Open up the folder where you have installed the Android SDK

2) In there should be a sub folder named platforms and a sub folder named platform-tools. Within the platforms folder should be a folder named android-8. Create a new folder in the android-8 folder and name it "tools".

3) Copy the contents of the platform-tools folder (located at the base of the SDK, next to the platforms folder) into the newly created tools folder.

Warm Regards

Michael

Greg DeVore

I followed your advice and was able to link to the folder. However, after selecting the ANDROID option, I attempted to TEST the program. When I did the TEST I received the following message: UNKNOWN DEPLOYMENT PLATFORM.

Any suggestions would be helpful.

Michael McCreary

Hi Greg,

To test with a physical device, you need to make sure your device is connected and you have selected it as the test target. To do this, select your device in the Development -> Test Target sub menu from the IDE.

To test with the emulator, you need to have created a virtual device (see step Configuring a Virtual Device), have that device running in the emulator (see step Starting the Virtual Device Simulator) and have selected that device as the test target. As above, to set the test target, select your device in the Development -> Test Target sub menu from the IDE.

For more information, see the step Running Under Android.

Warm Regards

Michael

Holly Billinghurst

Thanks Michael, your tweak worked a treat!

Bill Moseley

I have followed the instructions and have the emulator running. When I go to the Test Target menu, my emulated device does not appear as an option.

What did I miss?

Hanson Schmidt-Cornelius

Hi Bill,

there are usually two reasons for this:
1. The path to the Android SDK has not been configured in the LiveCode Preferences.
2. The emulator is not registered with LiveCode.

You can address point 1 by following step "Configuring LiveCode for Android Support" in this lesson.
Point 2 can be addressed by closing the emulator and LiveCode down. Then start the emulator and wait until it is up and running. Next start LiveCode. The emulator should now be accessible.

Hope this helps.

Kind Regards,

Hanson

Grahame

why are you using the windows version of the SDK install etc for a mac?
This is of no use to a mac user if you want to run an emulator.
Or even just setting up a real device.
Can you do a tutorial that shows the real mac way that things work? PLEASE

Hanson Schmidt-Cornelius

Hi Grahame,

indeed. Thank you very much for spotting this. The images in the lesson have been updated.

Kind Regards,

Hanson

Ilpo

Solution for the:

"chosen folder is not a valid android SDK folder"-error.

You need specify the path where the sdk-manager's .exe file is. So just check it's location from the sdk-manager-icon from your desktop. It's in C:/users/yourname/AppData/Local/Android/etc... The "AppData" folder is hidden. So just copy paste the address to LiveCode directly from the address bar.

Steve Wagenseller

Has something changed with the newest downloadable version of Android? The filename listed above ("android-sdk-mac_x86/tools/android") does not exist.

ahmad jefri

Hello!

I am encountering a similar problem to the first question here and I've tried doing the solution outlined in the second response. It keeps telling me an error of not being able to identify the 2.2 SDK.

I am currently using 5.5.3 Livecode with the latest andoid SDK bundle dated December 2012.

Please help as I am gradually loosing interest in learning. Setting andoid application development setting is kinda tricky and iOS is far trickerier than this.

Thanks in advance.

Hanson Schmidt-Cornelius

Hi Steve,

I just downloaded the latest Android SDK and /tools/android still exists in the SDK directory. Maybe try to install it again. I downloaded the ADT version and then copied and referenced the SDK directory in that.

Kind Regards,

Hanson

Hanson Schmidt-Cornelius

Hi Ahmad,

In order for LiveCode to use the SDK, you need to make sure that at least the packages under "Android 2.2 (API 8)" are installed. The Android SDK Manager allows you to download and install these packages. The packages should look something like this:

Android 2.2 (API 8)
SDK Platform 8 3 Installed
Samples for SDK 8 1 Installed
Google APIs 8 2 Installed

You can start the SDK manager by running the file: "/tools/android" in your SDK package.

Kind Regards,

Hanson

ahmad

Hanson you are an angle!

Worked like a charm when I tried it on my macbook! For some unknown reason it did not complete the installation on my 7 year old iMac!

Best regards.

Greggory DeVore

HELP. I followed your instructions. When I tried to run in the emulator I received this message: Unable to build app for testing: debug certificate has expired, please refresh.

What do I do?

Hanson Schmidt-Cornelius

Hi Greggory,

as the messages states, your debug certificate has expired.

If a certificate does not exist, then Android automatically creates a new one for you. So all you have to do is delete the one that has expired.

As a safety precaution, I would strongly advise to keep a copy of anything you delete though.

You have to delete the "debug.keystore" file. This is located in your android development environment. Possibly located somewhere like: "~/.android".

Kind Regards,

Hanson

Hanson Schmidt-Cornelius

Hi,

there have been some reported issues with linking to the Android SDK from with LiveCode 6.0. This issue has been addressed with LiveCode 6.0.2-rc-1 and later.

Kind Regards,

Hanson

Nikki

Every time I try to create a virtual simulator, the program hangs and becomes unresponsive. Is there a work around?

Hanson Schmidt-Cornelius

Hi Nikki,

when you refer to "the program", I assume that you are referring to the android AVD manager.

There could be a number of reasons for this hanging. I would recommend having a look at Google's information on managing AVDs. This may give you more insight into what is required to set up an AVD: http://developer.android.com/tools/devices/index.html

Kind Regards,

Hanson

Rory

I've done all the stages and they've worked how it says, but the test button is still ghosted. What have I done wrong?

Thanks

Hanson Schmidt-Cornelius

Hi Rory,

From the menu bar, select the following: "Development -> Test Target"

If everything worked, then you should be able to select the target you would like to deploy to. The target name should be in black characters. If the target name is grayed out then you have not set up the standalone options to deploy to Android. If the target does not exist, then you have not started you Android simulator or a devices is not detected.

Kind Regards,

Hanson

Amsterfrank

Awesome. This lesson is working like a charm :)
Indeed I got that black-screen on 2.2 but it went fine one 2.3.3. Thanks.

The only issue still, is that my emulator crashes my apps, when I click on the emulator's orientation-button. But standard apps of the emulator itself crash as well. When I start with app-settings in Landscape mode, it does turn my app. Not perfect, but I can test most things :o)

Hanson Schmidt-Cornelius

Hi Amsterfrank,

thank you very much for the comment on our lesson and great you got it working.

It is a bit disconcerting that you are finding that the android application is crashing. From your description it sounds like this may be an issue with the emulator, as other apps are crashing too.

If you feel that the issue is related to LiveCode, then please feel free to launch a bug report a quality.runrev.com . This would allow us to investigate LiveCode problems further.

Thank you very much for your help.

Kind Regards,

Hanson

mark5009

Hmm. Now Feb 2017 and looks like Google has pooched this. I'm running on Mavericks, using LiveCode 8.1.2 and have got a bunch of Android SDKs according to the SDK Manager---7.1.1 (API 25), 6.0 (API 23), etc.---but I can get none of them to be recognized by LC, even with the tools link added (as suggested in the comments). Perhaps it is my setup, but I can't seem to get this linked in at all.

Any help you can give would be appreciated.

Thanks in advance .. mark.

Add your comment

E-Mail me when someone replies to this comment