LiveCode and Android Studio - 8.1.5 onwards

As of LiveCode 8.1.5 you can use Android Studio with LiveCode to set up Android deployment.

In this lesson we assume you have the Java SDK installed, if you have not done this yet please follow the steps in the relevant lesson.

How do I Become an Android Developer on a PC?

How do I Become an Android Developer on a Mac?

How do I become an Android developer on Linux?

 

Opening the SDK Manager

Opening the SDK Manager

Begin by starting up Android Studio.

LiveCode requires the Android 4.0.3 (API 15) Package to be installed. To open the SDK Manager, which allows additional packages to be installed select SDK Manager from the Configure menu on the Android Studio opening screen.

Installing the required packages

Installing the required packages

The Android SDK Manager lets you select the packages you would like to install in you Android development environment. 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 (IceCream Sandwich) in the list and click the Apply button to install the package.

Note: you can see the Android SDK location at the top of the Window, take a note of this as you will need it in the next step.

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 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.

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.

Deploying to an Android device

Now you have your LiveCode Android preferences set up you can deploy to an Android device or emulator.

You can find a description of these setups in the following lessons

How do I Become an Android Developer on a PC?

How do I Become an Android Developer on a Mac?

How do I become an Android developer on Linux?

 

23 Comments

Nelson

I tried configuring the Android SDK without luck. Installed Java in the same directory and the Android SDK and the same message appears. The Android SDK installed is the 4.0.3 using the Android Studio. The Java is the latest version. Any help on this?

Tom Bodine

Be sure you have LiveCode 8.1.5 or later. Older tutorial lessons have directions that may not work for the latest LiveCode. (You didn't say what error message you are getting, so hard to give specific advice.)

Christopher Flatt

Should this work on Mac OS X Sierra, with Livecode 8.1.4? I'm not having success here...

Panos Merakos

Hi all,

As Tom said, this lesson will only work with LiveCode 8.1.5 RC-1 or later.

Best,
Panos
--

Tom Bodine

Hi,
I have 8.1.5 (on Windows) configured with the Android sdk and java path is populated. And I've created a virtual machine with AVD Manager. However, the "test" and "test target" menu items remain grayed out, as does the toolbar's "Test" icon. What is the trick to making LC use an Android virtual device in LC 8.1.5?

Panos Merakos

Hi Tom,

You have to open a stack, and select "Android" in the standalone application settings. This should enable the "Test Target" and "Test" options.

Tom Bodine

Still not working. I tried two approaches:
1) Opened an AVD. Then opened LC 8.1.5 (rc1), opened a stack, selected only the Android build options, confirmed Android SDK selected in Preferences. But all "Test" options remained grayed out.
2) Reset test by quitting the AVD and LC. This time, opened LC 8.1.5 first. (All Test menus grayed out.) Confirmed Prefs > Mobile Support show the Android SDK and JDK paths. Confirmed Standalone App. Settings is checked only for Android build. ("Test" menus still grayed out.) Then opened Android Studio and launched AVD Manager, selected my AVD and launched it. AVD fully loads, but LC test menus remained grayed out.

Advice?

Tom

Panos Merakos

Hi Tom,

Hmm that's strange. Sometimes the "Test" button of the LC menubar is greyed out for me too (although I have the proper setup). However, if I just click on it, it is enabled. If you have not done this already, I suggest you give it a try.

BTW which version of Android Studio are you using? And how do you launch the AVD Manager?

Panos
--

Tom Bodine

Clicking the greyed Test icon does nothing. I have Android Studio 2.3.3. I launch my AVD from Studio using menu Tools > Android > AVD Manager. Then I launch my virtual device by clicking the green arrow under Actions.

Panos Merakos

Hi Tom,

I have exactly the same setup and it works as expected for me. I suggest you file a bug report at quality.livecode.com so as we can investigate this issue further.

Best,
Panos
--

Tom Bodine

Panos,
Are you using the 64-bit version of Android SDK or x86? Mine is the 64-bit. Wonder if that could be the issue.
Tom

Pablo Miranda

I follow all steps to install LC 8.1.5 and Android Studio. When i make a simple App for android, a button and 'hello world' i can't install it on a Xperia Z2. Always appear the message 'Analysis Error: An error occurred while parsing the package ' (Original message: 'Error de Analisis' 'Se ha producido un error al analizar el paquete')... Someone know where is the problem??

If do you want i can send you the project by e-mail!!

Thnak you!!!!

Elanor Buchanan

Hi Pablo

Firstly check your Android Standalone Settings and ensure you have the Identifier and Minimum Android Version set.

You may also need to enable USB debugging on your device.

I hope that helps.

Elanor

Elanor Buchanan

Just following up with another thought. If you are building a standalone and then copying it to your device you need to choose "Sign for development only" in the Signing section of the Android Standalone Settings. Alternatively, to test directly, you can connect your device, choose it from the Test Target in the Development menu and then use the Test button on the Menubar to test on your device.

Tom Johnson

Could someone please verify this lesson? I'm running LC 8.1.6 and Studio 2.3.3
I'm pretty sure I've followed the lesson correctly. The problem is I consistently get the error: could not encode class bundle. I get this when sending to the VM or building a standalone. I pretty sure I'm not the only one having this happen.

Thanks,
Tom

Elanor Buchanan

Hi Tom, I have run through the lesson here and can successfully build for Android.

Have you installed the Android 4.0.3 package? Could you let us know what OS you are on and what version of the JDK you have installed so we can double check. I am on Mac and have JDK 1.8 installed which works.

Thanks

Elanor

Tom Johnson

Hi Elenor,
Thanks for the reply. I have installed 4.0.3. and 2.2
I’m on a Mac running OS 10.12.6 with LC 8.1.6 stable
Android Studio 2.3.3

Java 1.8.0_144 is installed on my machine.
However, when I look at Preferences > Mobile Support it has 1.7.0_65 shown in the JDK Path. Is that installed by Studio?

Thanks,
Tom

Tom Johnson

Hi Elanor,
The problem I was having was that there was a previous Java folder in the Library folder and even though I have admin on my machine, the Java 8 144 install wasn't added to the existing folder. I renamed the existing folder and re-installed Java 8 144 and it build a new folder with the correct Java level in it. That fixed the Java problem. I don't get "could not encode class bundle" anymore.

I am getting another error however. Could you please explain how you have your Android VM configured.

Thanks,
Tom

Elanor Buchanan

Hi Tom, glad to hear you got that part sorted at least. What error are you experiencing now?

Kind regards

Elanor

Tom Johnson

Hi Elanor. When sending to the VM.
[INSTALL FAILED_NO_MATCHING-ABIS: Failed to extract native libraries, res=-113]
Here's a link to the discussion.
http://forums.livecode.com/viewtopic.php?f=53&t=29660

Thanks,
Tom

Elanor Buchanan

Hi Tom

This error is caused by an incompatibility in the architectures. I've tested 2 emulators here and the one with an x86 CPU/ABI doesn't work but the one with an arm64 CPU/ABI does.

Can you try setting up an arm64 emulator and see if that works?

Kind regards

Elanor

Tom Johnson

Hi Elanor,
Yes, the arm64 works but as I'm sure you know, it's agonizingly slow. So is this something LC needs to fix?

Regards,
Tom

Elanor Buchanan

Hi Tom

I've spoken to our Development Team and they confirm that we don’t currently support 64-bit ARM on Android, nor x86 (32 or 64-bit). The Android engine is armv6 only at the moment so this isn't a bug, it is expected.

You would probably find it much faster to connect up your Android device and test directly on that using the Development menu Test options. That's what we do here in the office as it's much faster than using Android emulators. You'll need to enable USB Debugging mode on your device.

I hope that helps.

Kind regards

Elanor

Add your comment

E-Mail me when someone replies to this comment