How to Install .apk File onto an Android Device

The Problem

I am new to the Android platform. At work, I need to side-load our app for testing. My device is an HTC one of 2012. At first, I installed and ran the HTC Sync Manager from my MacBook Pro with hope that it could help me, but after half an hour, I gave up: I copied the .apk file to the file section, sync, then check the phone: I could not find that .apk file anywhere. It could be me, but for the life of me, I could not find a way to copy the file in question onto the device. There must be a better way.

My Solution

As I stated before, the problem is with me being a novice. However, I did spend a good half an hour googling for solutions to no avail. Finally, an idea came to me: what if I can transfer the file from my Mac to the HTC One via HTTP? With that though, I opened up a terminal session, cd to the directory where my .apk file is, and issued the following command:

python -m SimpleHTTPServer

That command created an impromptu web server to serve all the files within the current directory. From the HTC One, I fired up a web browser and jumped to my server: haiv-mac1.local:8000 and expected to see the directory listing. However, I could not connect to my Mac at all. Frustrated, I tried again and again, prepending http:// to the address, check my spelling, knelt down and prayed… But nothing worked. I tried the same address using my iPhone and it works. So the problem was with the Android device. Finally, I was able to connect using my Mac’s IP address. How I love Android!

Once I downloaded the file, it was a simple matter of tapping the Downloads icon, find my file, and tap on it to install.

Conclusion

I like the Android platform for giving me the ability to side-load apps, which is great for testing. However, the process could be simpler. Veteran Android users and developers might laugh hearing this story, but it is no joke to me. Until I gain enough expertise, I’ll stay with my trusty iPhone.

2 thoughts on “How to Install .apk File onto an Android Device

  1. zs

    The reason HTC one can’t find your web server(“haiv-mac1.local:8000”) is because lack of DNS mapping in your local network(and that’s the reason your mac ip works good), you need to modify your android device host file(“/system/etc/hosts”) like the ‘hosts’ file under windows environment(“%windows%\system32\drivers\etc\hosts”), you should be able to search (https://www.google.ca/search?q=android+host+file) for the hosts file modification instructions.

    You can take a look at this post(http://www.talkandroid.com/guides/beginner/install-apk-files-on-android/) as well.

  2. Hai Post author

    I disagree about the lack of DNS mapping: I have tried to connect to my local web server from Mac, Windows, Chrome Book, Windows phone, Android (Samsung Galaxy S4 and HTC One X), iPhone, iPad, … Of these, only the Android devices could not connect. If DNS mapping is a problem, none should be able to connect.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s