Distributing and installing apk’s using MacOS and Eclipse

Once you’ve developed an android app, you’ll want to send it to beta testers and end customers. This is actually pretty painless once you know how.

Create a keystore file.

To make an apk file that they can install, you have to sign it, and in order to sign it, you first have to generate a keystore. Luckily the android sdk comes with the tool to do this. You can generate the keystore file with the keytool app:

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

Replace alias_name with the name you want to use for the key. The first 8 characters are used.

You will be asked for a password. This will be requested whenever you sign an apk file with this keystore, so be sure to remember it! It will ask a number of questions after. I’m not sure which ones are required, but since it helps your customers to know how to contact you, its best to put in as much information as you’re comfortable with. I generally use the same password for the alias.

This will a file called my-release-key.keystore which you will use when signing the app.

Creating a signed apk file.

Now that you have a keystore file, you can create a signed apk file. To do this, right click on the base of your application’s tree in Package Explorer, select the ‘Android Tools’ menu, and select ‘Export Signed Application Package…’ Select after confirming the project. Click on ‘Use Existing keystore’, and Browse to where you generated the keystore earlier, and select the keystore. You will need to enter the password you used for the keystore file, and then again for the alias. Finally, it will ask you for the path the the apk file. Once you’ve selected where you want it to go, click on ‘Finish’, and the signed apk is saved for you!

Distributing/installing the apk file.

This is the easy part. You can email this apk file, and android devices will recognize it as being installable. You can put it on a web server, and browse for it using the android device. If there’s a way the android device can see the file, then you should be able to install from that.

The device will probably ask you to change the security setting to allow you to install the apk because its not a known source.