FANDOM


Android Setup Bearbeiten

In order to develop an app on Android with Livecode you need the following free tools:

Then you must launch Android SDK manager select and download at least:

  • all tools
  • Android API 2.2
  • Android API 4.0.3
  • (all other APIs you need)
  • all extras

Then probably you want to test you app with a "virtual phone". You can launch the Android AVD Manager (A.V.D. means Android Virtual Device), beware that an active virtual device it's very CPU and RAM consuming, so it's suggested to activate a virtual device on a multicore PC with 4GB or more of RAM.

However you can test your apps also with a old and slow PC, upload your app on your phone and click it with the phone file browser or upload on a website and download it on your Android device (phone or tablet) using the default browser, it will install the app on the device.

Then you have to start Livecode and go to Edit->Preferences->Mobile Support and select the path of your Android SDK and Java JDK. Paths is usually like: C:\Program Files\Android\android-sdk\ and C:\Program Files\Java\jdk1.7.0_45

(on linux is like /usr/lib/jvm/jdk1.7.0_45)

Now you can program in Livecode and create your app, testing it using the last button of Livecode toolbar "Test".

Remember that Android Virtual Device must be started manually in order to test your apps.

Now you have to specify to Livecode wich Device of the current runnings you want to use: go to Deleopment -> Test target and chosse the correct one, like the following image.

To install app, choose from File->Standalone application settings... -> Android -> Signing: sign for development only or sign with my key (and add your key in the next field); other sign options create invalid an app and it will not installed on phones.

You can create your personal key using the keytool proogram present in JDK bin/ directory. A typical command to create a keytool file is like:

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000

Windows 64bit Bearbeiten

If you encounter some troubles in Windows 64bit intallation, follow these steps:

  1. Install jdk-8u20-windows-i586.EXE
  2. Install jdk-8u20-windows-x64.EXE
  3. Install Android SDK (usually in C:\Program Files (x86)\Android\android-sdk-windows)
  4. Install Android SDK tools
  5. Install Android API 2.2 (and all other API you need)
  6. Install Android all extras
  7. in Android SDK manager uncheck the check box that allow upgrade to Version 23.
  8. in Livecode set the correct path to Android SDK
  9. in Livecode set the Java path to C:\Program Files\Java\jdk1.8.0_20


How to sign with Java 7 (and JDK) Bearbeiten

Note: read this chapter only if you have problem signing your app.

Java 7 changed way of signing method and livecode works with any version of java, but you if you encounter problem signing your app with livecode, read this chapter. If only you use your app, just set sign for development only, but if you want to distribute your app on a market, you need to sign it. These are the correct passages to manually sign your app:

  1. Create a program with livecode
  2. In File -> Standalone Application Settings... -> Android -> Signing choose do not sign
  3. Create the Android app with File -> Save as Standalone application (for example you obtained myApp.apk)
  4. Create a valid key with Oracle JDK keytool, this is the command on windows:
keytool.exe -genkey -v -keystore mykey.keystore -alias myalias -keyalg RSA -validity 10000

Keytool will ask you a lot of questions: please note that all answers supplied of the proposed questions by keytool must be different.

5. Sign the app with Oracle JDK jarsigner, this is the command on windows:

jarsigner.exe -sigalg MD5withRSA -digestalg SHA1 -verbose -keystore myKey.keystore myApp.apk myalias

That's all. Now your app is correctly signed.

Common errors Bearbeiten

There was an error while saving the standalone application, could not compile application class. Bearbeiten

This is probably the most common error message – it generally occurs when your Android settings in LiveCode are not quite right. If you want to deploy your LiveCode app to an Android device, then you will need to install the Java SDK and the Android SDK on your machine. You can find detailed instructions on how to do this in the following LiveCode lessons – one for Mac, one for Windows, and one for Linux:

http://lessons.runrev.com/s/lessons/m/2571/l/27389-how-do-i-become-an-android-developer-on-a-mac

http://lessons.runrev.com/s/lessons/m/4069/l/27385-how-do-i-become-an-android-developer-on-a-pc

http://lessons.runrev.com/s/lessons/m/2571/l/80751-how-do-i-become-an-android-developer-on-linux

Once you have installed these packages, you need to make sure that the path to the Location of Android Development SDK root in your LiveCode preferences is correct.

Unable to build app for testing – could not generate package manifest. Bearbeiten

This error is particularly tricky because it does not give enough information on what went wrong when the manifest file was generated. Every app must have a file named AndroidManifest.xml in its root directory. The manifest file presents essential information about your app to the Android system, information the system must have before it can run any of the app’s code. In LiveCode, this file is created based on the information provided in the standalone settings of the app. One of the fields in the standalone settings is the “Version Code.” This must always be a positive integer i.e. 1 and not 1.0 or -1!

This could also be caused by an incompatible icon selection in your "Basic Application Settings" section of the Android Standalone settings. Try clearing the selected icon and re-building.

Failure : [INSTALL_FAILED_UPDATE_INCOMPATIBLE] Bearbeiten

If you see this error, this means that the application that you want to install is already installed on the device. This usually happens when you already have a signed release version of the app on the device and you then try to deploy the debugged version to the device as well. The simple way to fix this problem is to remove the signed release version of the app from the device and then try to deploy the debugged version. Another solution would be to change the app identifier in the standalone application settings of the version that you are attempting to deploy to the device.

Failure : [INSTALL_FAILED_INCONSISTENT_CERTIFICATES] Bearbeiten

This error is quite similar to the previous one. It occurs when the signing key of the new copy of your application – on the machine that you are developing the app on – is not correct. It should be the same as the signing key on the old copy of your app, which is installed on the device. One of the reasons this could happen is that you developed the old copy of the app on a different machine. Another reason is that maybe the old copy of the app is signed with your production key and the newer version is signed with your debug key. The way to fix this problem is the same as in point 3: you can either remove the old copy from the device or change the app identifier in the standalone application settings and try again!

Parse error : There is a problem parsing the package Bearbeiten

This error comes from the Android operating system (OS) when trying to install an app on the device and could be caused by different things. One cause is a corrupted .apk file – an Android Package Kit (APK) file is the file format used for installing software on the Android OS. If you are using LiveCode, however, the .apk cannot be corrupted and so something else must have gone wrong. The most likely cause, if you are using LiveCode, is that a setting on the device prevents the .apk file from being installed.

In order to solve this problem, make sure you have turned on “Allow installation of apps from Unknown Sources” on your device. You can do this by going to the device’s settings menu, selecting “Applications” OR “Security” (on the most recent Android versions) and checking the box of “Unknown Sources” to allow installation of apps from sources other than the Google Play store.

Android 05116c391513e851 Bearbeiten

I came across this error for the first time recently. It happened with a LiveCode stack that I had already deployed to my Android device several times. First, I double checked that the path to my Android SDK root was correct, but it turns out the problem was that I had accidentally turned off USB debugging on my device! Once I enabled USB debugging on the device, the error message disappeared.

To turn on USB debugging, go to the settings menu on your device and select “Developer Options” (you’ll need to scroll down to find this!). Enable “Developer Options,” then you can enable “USB debugging.”

APK preparation failedBearbeiten

Android aapt.exe 22.01 is bugged, it stops randomly. Upgrade your build tools.

App not installed. The package appears to be corrupt.Bearbeiten

Some versions of Android need to uninstall the previous version of your app before installing the new version of your app.