How to sign APKs

Android Developer page explaining the same thing as below

To test your app on a device you must export an application installer packet (APK). The packet MUST be digitally signed, otherwise your android phone/tablet will not let you install it.