One part of testing an Android app is installing it on an actual phone and making sure that it still behaves as you expect. Given the fact that there are so many different vendors that tweak the OS in order to create a unique experience for their end users before shipping it off with their custom screen resolution phone, there is a lot that can go wrong with an android app. TechCrunch recently had an article about how a hong Kong based company tests their apps and it was a scary realization.
Back to our point here! Once you have the app ready, you may want to send it to a customer or another friend to validate and chances are that they do not have and Android development environment setup to compile your code and push it to the device, so here are two other ways:
(Note: the instructions here are geared towards linux based systems. Adjust as necessary for Windows)
The some-what technical way
- Install the Android SDK.
For the sake of this example we will assume it is installed in ~/AndroidSDK. (Note: For Windows you may need to installed the USB drivers as well)
- Make sure that USB storage is turned off. This is typically off by default and you can get to the screen once you have connected you phone to your PC via USB. Swipe down from the top of the screen (just like you do to see your notifications) and choose the USB Connected option.
- Make sure that you can install apps from unknown sources.
To do this, go to ‘Settings’, click ‘Security’ and make sure ‘Unknown sources’ is checked.
- Now open a terminal (or command) window and run the following commands to make sure that the SDk can see your device.
> cd ~/AndroidSDK/platform-tools > ./adb devices List of devices attached XXXXXXXX5B3900XX device
- Now run the following commands to install your .apk file. For the sake of this example, our file is located at ~/dev/myApp/bin/myApp.apk.
cd ~/AndroidSDK/platform-tools ./adb install ~/dev/myApp/bin/myApp.apk
You can optionally provide a -s parameter to install the app on the SD card.
- You should now see the app in the list of your installed apps
The really easy way
For folks that are not technical, there is an easier way.
- Go to the Google Play store and install AppInstaller (free app).
- Copy the .apk file to the SD card of your phone.
this can be done in two ways:
- If your phone has an SD card that can be taken out, you can insert the SD card into your PC and copy the file
- If your phone does not have an insertable SD card (like the Nexus S), then connect your phone to your PC via USB, turn on USB storage, copy the .apk file to your phone’s SD card and disconnect the phone
- Run the AppInstaller app
- The app will list all the apk files on your SD card. Select your .apk file to install it
Note: In this case, you may still have to check the option to be able to install apps from ‘Unknown sources’