Publishing APKs on your own web server (apache)

Публикувано / posted 2010-08-26 в категория / in category: Android
  

Yesterday I had some trouble publishing APKs my own site and I will share that experience.

I copied an APK to my server, tried to download it via phone's browser but I repeatedly got this error:

Download unsuccessful

After some investigation I found the solution:

First of all -- ensure that you can download and install APK from other sources(different from android market, i.e. normal web sites). If you can't -- this is completely different issue. There are a lot a threads in Android forums about this problem. Usually is caused by full SD card of the phone (internal) or some bugs in market/download manager. Try to free some space on phone's internal SD card and to clear the cache of several apps.

Then you have to ensure that Apache is sending correct Mime type when browser is downloading the file. You have to add following row (if not already present) in /etc/mime.types:

application/vnd.android.package-archive         apk

OR

in your httpd.conf / apache2.conf you have to add:

AddType application/vnd.android.package-archive .apk

Of course, both solutions require you to have permissions to edit these files which may not be the case on shared hostings in which case the only thing that you can try is to add AddType application/vnd.android.package-archive .apk to .htaccess file in your dir and pray that server's configuration is not too restrictive about what is allowed to be placed inside user's .htaccess.

After that -- if you have Basic or other auth set on the directory where APKs reside -- it won't work. There is a bug in phone's browser (at least on Samsung Galaxy S, Android 2.1) which prevents it from handling correctly http auth, i.e. -- when you try to browse directory protected by password you will be asked to login, then you will be able to browse it but if you try to download some file then browser does not sends auth info and the web server rejects the request with 401 Unauthorized which on the other hand causes browser to show error "Download unsuccessful"


Leave a Reply

Внимание: Моля, въведете само ПЪРВИТЕ ТРИ цифри от картинката
Important: Please enter just the first three digits from the image