How to Deploy Apps to Android Devices

by Panagiotis Merakos on July 21, 2015 8 comments

Are you writing an app for Android?

Do you want to test your Android app on an actual Android device?

If you are developing for Android and you want to test the app either in a simulator or on a physical android device, then you will need the Android software development kit (SDK). The Android SDK  enables developers to create applications for the Android platform.

One of the things that the Android SDK includes is an emulator – a virtual mobile device that runs on your computer. You can download the Android SDK for Mac, Windows and Linux. While the emulator is great, as it mimics all of the hardware and software features of a typical mobile device, there will be times when you want to test your app on a physical Android device.

Testing your LiveCode app on an Android device can be as easy as one click! But it can also go wrong – turning a straightforward process into a frustrating experience.

Here are the common error messages (with solutions) you are likely to encounter when deploying your LiveCode app onto an Android device.

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

couldNotCompile

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.

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

CouldNotGeneratePackage

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 !

3. Failure : [INSTALL_FAILED_UPDATE_INCOMPATIBLE]

UpdateIncompatible

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.

4. Failure : [INSTALL_FAILED_INCONSISTENT_CERTIFICATES]

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!

5. Parse error : There is a problem parsing the package

parseError

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.

6. Android 05116c391513e851

android_876uyt87693j

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

After doing these checks, you should be able to deploy your app to your Android device with just one click! Have fun!

Have you had any other error messages? Or have you seen similar messages and fixed the issues with different approaches? Please share in the comments!

Read more about Android development here.

 

Panagiotis MerakosHow to Deploy Apps to Android Devices

Related Posts

Take a look at these posts

8 comments

Join the conversation
  • Amigatech - July 21, 2015 reply

    Very nice! Thanks for sharing.

  • KimD - February 25, 2016 reply

    Parse Error – There is a problem parsing the package. Check your Standalone Application Settings > Android > Basic Application Settings > Identifier. I’ve always found that if I simplify my Identifier then the error goes away. Android doesn’t like overly verbose identifiers 😉

  • Jim - March 2, 2016 reply

    I’ve just posted this on the “Getting Started with LiveCode – Experienced Developers” forum under “stuck installing app on target device…”:

    I’m trying to deploy to a real Android tablet. I’ve managed to get the app installed on the device a few times. However more often than not it gets stuck on the window “Standalone Builder Progress” saying “Installing app on target device…”. There are no error messages about what the problem is either during the installation process or after from what I can see. The only way out is to kill the process with Task Manager.

    I’ve followed help I’ve found on the forums to delete the app before trying to reinstall and setting the Identifier. Still can’t get it to install reliably every time – very frustrating.

    Would appreciate help from anyone / some messages / logs from LiveCode to see what the problem is.

    Thanks,
    Jim

    Jim - March 3, 2016 reply

    KimD,

    I too have been getting
    “Parse error. There was a problem while parsing the package” from the package installer on my target Android tablet. I simplified the Identifier to org.uom.mobTempl but the same message still appeared. How simple are your Identifiers? Did you read this guidance somewhere?

    Thanks,
    Jim

    Jim - March 3, 2016 reply

    Just to be clear, I have allowed “Unknown sources” as in step 5. of Panos’ post & am using an apk generated by LiveCode. But I still get the “Parse error”. Grateful for any more suggestions.

    Thanks,
    Jim

    Panagiotis Merakos - March 3, 2016 reply

    Hi Jim,

    Have you made sure that an app with the same identifier does not already exist in the device? Some devices complain if this is the case, while some others just overwrite the existing app.

    panos - March 3, 2016 reply

    Hi Jim,
    If the app fails to install *sometimes*, then it could be that the android cable (micro-usb to usb) needs replacement. It has happened to me a lot of times. I would suggest trying with a different cable. Moreover, you can use the “adb devices” command in an OS X terminal. If your device is listed there, then this means that the problem is within LiveCode.

    Now if you see this problem *every* time you attempt an installation of an android standalone, but you did *not* have this problem some time ago, you may be affected by this bug:
    http://quality.livecode.com/show_bug.cgi?id=16664

    Jim - March 3, 2016 reply

    Panos,

    Many thanks for all your helpful suggestions. In my case, installing the apk outside LiveCode, when I changed the Signing option to “sign for development only” & created the standalone again the parse error didn’t appear & the app installed. However when trying to install with LiveCode “Test” the process got stuck on “Installing app on target device” even with that signing option.

    I’d already added to the bug report you mentioned since I’ve been in touch with the reporter on the forum but thanks for pointing it out.

    I do always delete the app on the target device before installing it again – seems to work. However there are a lot of factors for someone new to LiveCode & it’s easy to get confused over cause & effect!

Join the conversation

*