Building Standalone Applications
This tutorial guides you through the steps of creating an executable application that can be deployed to a Windows based operating system without needing the LiveCode IDE to function.
Introduction
Using the LiveCode Integrated Development Environment (IDE) to develop and test your applications is a great way to work, but not everyone has LiveCode installed or uses the same platform as you do. You may also want to distribute your work in such a way that other people do not see how you have implemented the functionality - for example if you sell your app. LiveCode allows you to save your application in formats that can be deployed to a range of platforms. This tutorial guides you through the fundamental steps of saving your LiveCode application for deployment to a Windows based operating system.
Application in the IDE
In order to create a standalone LiveCode application you first have to create an application in the LiveCode IDE. In this example, we are using the 3-5-7 game. You can find out how to write this game here: Game 3-5-7 - A Simple Interface.
Standalone Application Settings
Once you have an application you would like to create as a standalone, save its stack but do not close it in the IDE. The application must remain active in LiveCode. Then open the Standalone Application Settings dialog box. You open this by selecting Standalone Application Settings... from the File Menu (1). This dialog box provides an overview of the standalone platforms that are supported and other features you can add and configure for standalone applications.
Select the platform you would like to deploy to. In this case select the Windows icon (2). This opens the Standalone Application Settings for Windows deployment. Make sure that the Build for: Windows box has been selected (3). This also adds a small green tick mark next to the Windows icon. The other Standalone Application Settings can be configured with your preferences that are specific to the application. Here we have added the word "Game" to the Product Name field (4) and added the word "Game" to the beginning of the File Description field (5). Next, dismiss the dialog box. This completes the required configuration for a basic standalone build.
Saving as a Standalone
You build the standalone with the configuration you set up by selecting Save as Standalone Application... from the File Menu. This initiates a sequence of events that are accompanied by dialog boxes. If your application has been modified and the most recent changes are not stored on your hard drive, you are prompted to save the active stack. You are then prompted with a dialog that allows you to select a location into which you can save your standalone application. Once you have accepted this dialog and your standalone has been saved, you should see the message that is displayed on the screen of this step.
The Standalone
You can access the standalone by following the path to the standalone application area you selected as part of building the standalone application. Look for the file with the .exe extension and try to execute it by double clicking on it. This should open and display the application in a way similar to that shown in the image of this step.
Further Reading
This tutorial presents the fundamental steps for creating a standalone application in LiveCode that runs on Windows, but LiveCode supports more platforms, including Linux, Max, iOS and Android. For information on deploying to iOS, have a look at the following lessons: How do I Build an iPhone Application for iOS?.
MatthewL
When I try to save my save my game357 stack as a standalone for my Windows 7 machine, I get the following error:
"There was an error while saving the standalone application
Build failed for Windows: could not open output file"
Hanson Schmidt-Cornelius
Hi Matthew,
this error would suggest that you do not have permissions to write to that directory location. Try writing to a different location to which you know you have write permissions.
Kind Regards,
Hanson
MikeM
I made a stack that reads a bunch of text files, manipulates the data, and creates an HTML file in a subfolder.
Works great in IDE mode. But when I turned it into a standalone program, it didn't generate the HTML file. No error messages, but no file, either.
Hanson Schmidt-Cornelius
Hi MikeM,
there could be many reasons why you are not getting an output file. My initial assumption would be that you have an issue with the path and file name you are trying to write to.
Have a look at the specialFolderPath function in the LiveCode Dictionary and follow links to other related dictionary entries from there.
For debugging, you could also launch an answer dialog that shows you the path your application is trying to write to. Maybe the file is being written somewhere you are not expecting.
Without additional information, it is difficult to identify the problem any further. If you are not able to address this problem, please have a look on our forums at: http://forums.runrev.com/
Or contact our customer support with a sample stack that demonstrates the problem, the version of LiveCode you are using and the Operating System building and running the application on. You can contact customer support at: [email protected]
Kind Regards,
Hanson
james
I have a hello world tester aving successfully as a standalone windows app, but when I try to run as Android app I get "There was an error while saving the standalone application could not compile application class"
Hanson Schmidt-Cornelius
Hi James,
yes, in order to build standalones for Android you need to reference the Android SDK in LiveCode. If you do not do that, you will get the error you are describing.
Have a look at the following guide: http://livecode.com/developers/guides/mobile/android/
This tells you how to set up your Android environment, so that you can build standalones.
Kind Regards,
Hanson
Daniel
App won't run. Did the Hello World app. Saved as stand alone. Copied APK to phone. Selected it for install. APP not installed is the result.
Hanson Schmidt-Cornelius
Hi Daniel,
your comment is on a lesson for deploying standalones on Windows based systems. Maybe you are missing the information on how to create standalones for Android. There are lessons that are very much more applicable to what you need. have a look at the following to see if this helps you further:
How do I Become an Android Developer on a PC
http://lessons.runrev.com/s/lessons/m/4069/l/27385
How do I Become an Android Developer on a Mac
http://lessons.runrev.com/s/lessons/m/4069/l/27389
The Basics: How do I Create Hello World on Android
http://lessons.runrev.com/s/lessons/m/4069/l/27733
Kind Regards,
Hanson
Daniel
Hi Hanson,
I actually did all that. The emulator fails too. Says unknown platform. Which is why I decided just to copy the apk that was generated to an android phone. It is very cumbersome to install Live code. Just to get it to run I had to uninstall all the software and re-install several times. I am running a Win 7 pro laptop. It would be much better if Live code didn't depend on other people's software. Installation and functionality would be much simpler. My supervisor is hoping we can get this working because we can't afford to hire a developer, so I am it. If this works. Thanks
Hanson Schmidt-Cornelius
Hi DanielHi Daniel,
The emulator behaves very much in the same way as an Android device, whereby you should be able to select either the device or an emulator from "Development -> Test Target". You may get an "unknown deployment platform" message if you do not specify what the target is.
There are a number of key points to implement in order for the Android development environment to work, and these points are covered in the relevant lessons I referred you to in my previous comment. I would imagine that it should not be necessary for you to uninstall and reinstall all the software again, but you should ensure that you have the latest version of LiveCode (6.1). There was an issue with a previous version of LiveCode and the Android development environment.
In your comments, you do not go into too much detail of what you have done and where you are with the installation so I will now provide you with a few stages that you should complete as part of a successful installation:
1. Make sure all the required external software has been downloaded and installed
2. Start Android, this should automatically open the package manager.
2.1. Ensure that at least the Android 2.2 (API level 8) is installed.
3. Open LiveCode and ensure that LiveCode can see the Android installation.
3.1. You can set this up under Preferences -> Mobile Support.
4. Create an Android emulator AVD or plug in your Android device.
4.1. If you create an AVD, remember to launch the emulator with the AVD
5. Start developing code for Android.
If this did not help address the issue, then please feel free to contact our customer support at: [email protected] or have a look at our mailing lists and forums (http://livecode.com/community/) for information from our community. You may find that someone somewhere has had the same issue as you have at the moment.
Kind Regards,
Hanson
Monty May
I get the following when trying to save my mainstack containing many substacks as a standalone to the Windows platform in LC 8.1
573,920,1,appendToList
253, 920,1
241,917,1,__RecursiveStackFileList
353,0,0,stack "C:/Program Files (x86)/RunRev/LiveCode Indey 8.1/Toolset/lbraries/revsblibrary.livecodescript"
and so forth
The words "appendtolist" and "recursivestackfilelist" do not appear in the LiveCode forums.
Thanks for any pointer.
Monty May
Panos Merakos
Hi Monty,
This is caused by a bug in LiveCode 8.1.0, which is fixed in LiveCode 8.1.1. For more details see here: http://quality.livecode.com/show_bug.cgi?id=18429
You can find the latest LiveCode versions (that include the fix) here:
http://downloads.livecode.com/livecode/
Best regards,
Panos
--
David Garoutte
I am trying to create a standalone app from the SQLite_example:
http://lessons.livecode.com/m/4071/l/30516-how-to-create-and-use-an-sqlite-database
but I get this error: "could not compile service support class".
Any suggestions?
Elanor Buchanan
Hi David, it sounds like there is something not quite right in your Android setup. The first things to check are
1. That you have installed the Android 4.0.3 SDK package.
2. If you are in Windows that you have installed Java 8. LiveCode is not currently compatible with Java 9 or 10 and this has been reported.
We have a lesson on setting up Android here http://lessons.livecode.com/m/2571/l/625198-livecode-and-android-studio-8-1-5-onwards.
You can also find some suggestions from people who have experience the sam issue on our forums
https://forums.livecode.com/viewtopic.php?t=30148
I hope that helps, if not please let us know.
Kind regards
Elanor
David Garoutte
Elanor, thank you for your fast response. It was exactly what I needed.
I realize now that my question was incomplete. My goal is to create a Windows standalone app with an SQLite database. After extensive searching through the forums, stackoverflow, etc., I couldn't find anything that mentioned Windows, SQLite, and the error I was getting. That's because there is no such issue. I explored the Standalone Application Settings further -- adding Database to Inclusions (as I saw suggested in an old forum post), setting Property Profiles (for what reason I don't know yet), and retrying and re-searching -- until I saw that "Build for" MacOS and Android were checked by default. When I unchecked those boxes and reset everything else to the default settings, it worked like a charm. So the only issue in this case was my ignorance.
I am very impressed with LiveCode and look forward to expanding my knowledge to include an Android version in my project. Thank you so much for your kind attention.
David