Tuesday 10 July 2012

Introduction To Android APK Files

The Android image is provided by Google using the Creative Commons 3.0 Attribution License - here is the source page.

What is an Android APK File?

An APK file is an archived Android Package file, and will be saved with ".apk" extension. If you have an Android phone, tablet, computer or other mobile device, it will already have APK files on it. APK files are used for distributing and installing Android applications, and contain the compiled code necessary to run those applications on devices with the Android operating system installed. Apps for Android devices are almost always installed from an APK file.

What do I need to Know about APK Files?

As a normal user of an Android phone, you will typically not need to be aware of APK files. You can get normal use out of your phone without ever having to worry about APK files, as the Android operating system automates handling of them in most cases.There may be occasions where you need to handle APK files if you download non-market applications, i.e. apps from some source other than the official Android Market.

However, APK files are a vital ingredient in Android development. If you are a mobile application developer for Android, or are thinking about learning Android mobile development, then you will have some involvement with APK files, for your own and possibly other apps.

How are APK Files created?

APK files for Android apps are generated by developers. When you develop an application for the Android platform using an IDE such as Eclipse with the Android Developer Tools installed, the process of generating an APK file is as simple as a few clicks. You will also have to sign your applications before they can be released, downloaded and installed by users.

If you want to export an APK from an app you're developing in Eclipse:

  • Select your Android project in the Eclipse Package Explorer, right-click and choose Android Tools then either Export Signed Application Package or Export Unsigned Application Package.
  • If you only export an unsigned package, you will not be able to release your app on the Android Market, but may be able to test it on your own devices (although this depends on your settings).
  • To sign your applications, you need to use the Keytool and Jarsigner utilities, both of which come as part of the development kit. Here's an overview of application signing: Android Developers: Signing Your Applications.

How are APK Files Distributed?

APK files are mostly downloaded through the Android Market, with Android devices automatically installing them once downloaded. Some APK files are also distributed over the Internet, in which case they can be stored on or copied onto an Android device before being installed.

Basically, an APK file contains all of the necessary information for an application to be installed and run, including the code and resources such as images and data. However, the Android system can be configured to prevent installation from sources other than the Android Market. In this case, you will need to alter your settings if you want to install apps from other sources.

To set your phone up to install non-market apps:
  • Open your device application menu
  • Choose Settings
  • Choose Applications
  • Check the Unknown sources box

How are APK Files installed?

In most cases APK files are used to install apps automatically through your device's Android Market program. However, if you find yourself trying to install an APK file manually the process is typically straightforward. If you're installing an app you've developed or have on a computer or other storage location, copy it onto your device memory, for example onto the SD card.

Using whatever file explorer application you have installed, it is generally the case that simply tapping on the APK file will prompt you to decide whether you want to install it. If you do not have a file explorer program already, I would thoroughly recommend the free ES File Explorer, although there are loads of others that get great reviews too.

Once you have an app installed and want to update it manually, for example where you've refined an application you're testing, simply export a new APK, copy it onto the device again and browse to it, installing it in the same way you did the first time.

You can also install APK files using the Android SDK (Android Software Development Kit), but this is more complex. Here's a guide: Talk Android - A Guide To Installing APK Apps On Your Google Android Phone.

Do I need to Remove APK Files?

Remember that APK files and apps are two different things. The APK files contain the information necessary for your device to install the program, but once this has been done the APK file is no longer necessary. If you copied APK files for installation onto your device, you can safely delete these copies once the apps are installed.

Links

The Developers Guide | Android Developers
Android Developers Blog
Google Play
Android Things Blog
How To Uninstall Android Apps | The Tech Interpreter
What Are Android APK Files? | The Tech Interpreter
Frequently Asked Questions About Android Apps | The Tech Interpreter

No comments:

Post a Comment