简体   繁体   English

无法从drupal站点通过webbrowser下载.apk

[英]Unable to download .apk via webbrowser from drupal site

I have a drupal-based website where people can log in and see private discussion forums. 我有一个基于drupal的网站,人们可以登录并查看私人论坛。 This is where I want to have my beta testers for my Android application download the beta .apk files. 这是我希望我的Android应用程序的beta测试人员下载beta .apk文件的地方。 I tested this thoroughly on my Android 1.6 based myTouch 3G, and was able to log in, and download files attached to forum posts without problems. 我在基于Android 1.6的myTouch 3G上彻底测试了这个,并且能够登录,并且可以毫无问题地下载附加到论坛帖子的文件。

Now comes the interesting part: my testers on Droids and Nexus Ones (Android 2.0.1 and 2.1) were complaining that their downloads are failing. 现在有了一个有趣的部分:我在Droids和Nexus Ones(Android 2.0.1和2.1)上的测试人员抱怨说他们的下载失败了。 Since I don't have an 2.0 phone, I tried it out in a 2.0 emulator, and lo-and-behold, it didn't work. 由于我没有2.0手机,我在2.0模拟器中尝试过,而且看起来不行。 The download shows the indeterminate progress for a second or two, then shows "Download unsuccessful". 下载显示一两秒的不确定进度,然后显示“下载失败”。

Based on what I see in the logs, it is apparent that the server is returning a 404 for the download request from 2.0 browsers. 根据我在日志中看到的内容,显然服务器从2.0浏览器返回404下载请求。 I can download to my desktop and 1.6 phone no problem. 我可以下载到我的桌​​面和1.6手机没问题。 The only reason I can think of that the server would return a 404 for a request is that for some reason the credentials or cookies aren't being passed by the download process. 我可以想到服务器将为请求返回404的唯一原因是由于某种原因,下载过程未传递凭据或cookie。 Logcat shows: http error 404 for download x Logcat显示:下载x的http错误404

Some background: I added the mime type to my .htaccess like this: AddType application/vnd.android.package-archive apk 一些背景:我将mime类型添加到我的.htaccess中,如下所示:AddType application / vnd.android.package-archive apk

I checked the server logs and see the following for failed downloads: xx.xx.xx.224 - - [28/Jan/2010:20:39:00 -0500] "GET /system/files/grandmajong-beta090.apk HTTP/1.1" 404 - " http://trickybits.com/forums/beta-testing/grandma-jong/latest-version-090-b1 " "Mozilla/5.0 (Linux; U; Android 1.6; en-us; sdk Build/Donut) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1" 我检查了服务器日志,并看到以下失败的下载:xx.xx.xx.224 - [28 / Jan / 2010:20:39:00 -0500]“GET /system/files/grandmajong-beta090.apk HTTP /1.1“404 - ” http://trickybits.com/forums/beta-testing/grandma-jong/latest-version-090-b1“”Mozilla / 5.0(Linux; U; Android 1.6; en-us; sdk Build / Donut)AppleWebKit / 528.5 +(KHTML,类似Gecko)版本/ 3.1.2 Mobile Safari / 525.20.1“

This sounds like it's related to a long standing problem I've experienced when trying to serve APK's from my own web server. 听起来这与我在尝试从我自己的网络服务器上提供APK时遇到的长期问题有关。 This is not the MIME problem, its not file permissions and there's no path tomfoolery going on. 这不是MIME问题,它不是文件权限,并且没有路径tomfoolery继续。 It's as far as I can tell a bug in the Android browser. 据我所知,它可以告诉Android浏览器中的一个错误。 What I find is with Apache, if I add a .htaccess file which restricts the file/directory, ie you'd want it to prompt for a username/password when downloading from a browser, it fails with the error you describe. 我找到的是Apache,如果我添加一个限制文件/目录的.htaccess文件,即你希望它从浏览器下载时提示输入用户名/密码,它会因你描述的错误而失败。 Remove the .htaccess and all is well. 删除.htaccess,一切都很好。 Not good when you've a public website you want to stick your secured test APK's on. 当你有一个公共网站,你想坚持你的安全测试APK时,不好。 Your site is drupal - I'd check for any restriction like this in effect, or indeed if it's not the restriction itself but the presence of the .htaccess file since the exact cause isn't clear. 你的网站是drupal - 我会检查这样的任何限制是否有效,或者确实如果它不是限制本身但是存在.htaccess文件,因为确切原因不明确。

By the way, an elegant solution to this is to use dropbox. 顺便说一句,一个优雅的解决方案是使用Dropbox。 You get your users to install it on their handsets, and when you drop the APK to it, not only are they all notified immediately, but they can then just click the link in their status bar and the app installs, ie no MIME or server work needed at all. 您可以让用户在手机上安装它,当您将APK放到手机上时,不仅会立即通知他们,而且他们只需点击状态栏中的链接并安装应用程序,即无MIME或服务器工作需要。

I know this is an old issue, but I'm having the same problem nowadays. 我知道这是一个老问题,但我现在遇到了同样的问题。

The only workaround I found is to ask users to download the apk from a non built in navigator which is very confusing and annoying (Opera is in fact working ok). 我找到的唯一解决方法是要求用户从非内置导航器下载apk,这非常令人困惑和恼人(Opera实际上工作正常)。

If anyone has found a solution for the build in browser, it would be really appreciated if posted! 如果有人在浏览器中找到了构建解决方案,那么如果发布了,我们将非常感激! :) :)


Also I've noticed: 我也注意到了:
I'm working in a LAN where the server is in 192.168.1.15. 我在局域网中工作,服务器位于192.168.1.15。 I have resolved in "hosts" of local computers the domain name to the server address (if not, the domain name resolves to the router). 我已经在本地计算机的“主机”中解析了服务器地址的域名(如果没有,域名解析为路由器)。 In Android I haven't resolved the domain name, so when the internal browser tries to navigate to the domain name, instead of resolving to the server, it resolves to the router, as expected. 在Android中我还没有解析域名,所以当内部浏览器尝试导航到域名时,它不会解析到服务器,而是按预期解析为路由器。 What is surprising is that Opera is resolving to the server, like if there was a proxy or something like this. 令人惊讶的是,Opera正在解析服务器,就像有代理或类似的东西一样。 At least it acts like if the traffic is comming from outside the LAN. 至少它的行为就像流量来自LAN外部一样。

Maybe this is what is making Opera to work on downloading the files. 也许这就是使Opera能够下载文件的原因。

Sorry if my english is not well enough to explain more clearly but hope it is understandable. 对不起,如果我的英语不够清楚,但希望这是可以理解的。

The default storage location for drupal files is /sites/default/files. drupal文件的默认存储位置是/ sites / default / files。 If you uploaded the file via Drupal (as a node or whatever) it will be here. 如果您通过Drupal上传文件(作为节点或其他),它将在这里。 You should also check out the file /sites/settings.php or your file uploads settings (http:///admin/settings/file-system) to see where your files are being stored. 您还应该查看文件/sites/settings.php或文件上传设置(http:/// admin / settings / file-system)以查看文件的存储位置。

This is not a MIME type issue, so remove the entry for the apk files unless you want the server to attempt to read them. 这不是MIME类型问题,因此除非您希望服务器尝试读取它们,否则请删除apk文件的条目。

Are the apk's signed? apk是签名的吗? Maybe the later versions of Android expect only signed apps. 也许Android的更高版本只需要签名的应用程序。 http://tordtech.blogspot.com/2009/10/signing-android-applications.html http://tordtech.blogspot.com/2009/10/signing-android-applications.html

As the owner of a 2.0+ phone (Droid X) I found that I was having the same issue trying to download my own APKs. 作为2.0+手机(Droid X)的拥有者,我发现我在尝试下载自己的APK时遇到了同样的问题。 I worked around it: oddly enough, downloading Astro File Manager, for whatever reason, enabled me to do so. 我解决了这个问题:奇怪的是,无论出于何种原因,下载Astro文件管理器使我能够这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM