How do I Become an Android Developer on a PC?
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 a PC with Windows operating system. 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 a PC that has the following software installed:
Note: It is assumed that you are familiar with the installation process of a Windows 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 PC.
Downloading Java SDK (JDK)
If you do not have the Java SDK (JDK) installed, then 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. 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.
Installing Java SDK
The Java SDK (JDK) installer lets you specify the path and the components you would like to install. LiveCode Android support does not require any configuration to the Java SDK (JDK) package or path selection and works with the default settings. You can continue the installation by selecting the Next > buttons that lead you through the installation wizard.
2016-08-22 11_27_29-Java SE Development Kit 8 Update 101 - Custom Setup.png
Downloading the Android SDK
If you do not have the 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 will find this at the bottom of the page. Save the file to your file system.
Installing the Android SDK (1)
Unzip the downloaded zip file into a folder named "sdk". Then move the folder to the location you want to store your Android SDK. You will need to refer to the folder later so place it somewhere accessible.
Move the SDK Manager and AVD Manager
sdk/tools/lib folder you will find the files "AVD Manager.exe" and "SDK Manager.exe". Copy these files and place them in the sdk folder.
Installing the Android SDK Packages
LiveCode requires certain Android packages to be installed. The Android SDK Manager lets you select the packages you would like to install in your Android development environment. Start "SDK Manager.exe" to install the required packages.
By default, only a few packages are selected. From this version of the SDK I would recommend keeping the default selection.
LiveCode requires the Android 4.0.3 (API 15) Package to be installed. Select Android 4.0.3 (API 15) in the list and click the Install button to install the package.
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.
Configuring a Virtual Device
Once you have installed the required packages, you can use the Android 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 launch the AVD manager from Start Menu of your Windows Manager.
You can set up a virtual device as follows:
- Make sure the Android AVD Manager is running.
- Select New... .
- Choose the Name for your virtual device.
- Set the Target
- Fill in the SD Card Size.
- Optionally enable Snapshot. This speeds up the launch of the emulator.
- 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.
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-
- Go to Settings> About> Software Information> More
- 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”
- Navigate to Settings> Developer options
- Check option for Android Debugging
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 Edit -> 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 folder 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 4.0.3). (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 folder hierarchy to access the root folder. The root folder may look something like: ...android-sdk-windows. Please go through the following steps carefully.
Check your file path to correct any error
If you get an installation error, check you have followed these steps precisely:
1.) Identify the correct zip file. The .zip that has just the command line tools is called "tools_r25.2.3.zip", and it contains *only* a folder called "tools".
2.) Extract this zip into a folder called "my_android_sdk". After extraction, you should see "my_android_sdk/tools" as the filepath.
3.) Go to "my_android_sdk/tools/lib" and copy the files "AVD Manager.exe" and "SDK Manager.exe", and paste them into the folder "my_android_sdk" NOT into tools.
4.) Double click on "my_android_sdk/SDK Manager.exe" to launch the sdk manager, and use sdk manager to download the "Android 4.0.3 (API 15)".
5.) In the sdk manager, also check "Android SDK Platform-tools" and "Android SDK Build-tools". Those should appear at the top of the sdk manager window.
6.) Install all those packages. After all they are installed your "my_android_sdk" folder should include several new subfolders ("platforms", "platform-tools", "build-tools" and others).
7.) Open LiveCode, go to Preferences-> mobile support, and choose the "my_android_sdk" folder.
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 resources among platforms, factor your 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 Copy Files 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 an adequately configured physical device is connected before trying to test your code. Then select a device from Development -> Test Target. The Test icon on the main pain of the LiveCode IDE should now be active and allow you to deploy your LiveCode application.
Note: When deploying to a device, you may receieve 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
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.