安装使用 Chrome 下载的 apk 时出现解析错误,但使用 Firefox 下载时运行正常

Parse error when installing an apk which was downloaded with Chrome, but works just fine when downloaded with Firefox

我正在从远程服务器下载 apk,当我通过 firefox 下载它时,它会安装并 运行。当我使用 Chrome 下载 apk 时,我在我的 adb logcat 中收到以下消息:

D TelemetryService: event FunctionalEvent not sent because of consent:NONE , event gdpr level:FUNCTIONAL , event client id:91452636138522988

D         : Zip: EOCD not found, /data/user_de/0/com.android.packageinstaller/cache/package1805045880.apk is not zip
W zipro   : Error opening archive /data/user_de/0/com.android.packageinstaller/cache/package1805045880.apk: Invalid file
D asset   : failed to open Zip archive '/data/user_de/0/com.android.packageinstaller/cache/package1805045880.apk'
W PackageInstaller: Parse error when parsing manifest. Discontinuing installation

我还可以使用 USB 安装该应用程序。这表明 apk 本身没有损坏。我想知道为什么它不能通过 Chrome?

p.s。使用 android 设备 7 或更高版本。

我们明白了,显然 firefox 会下载文件并将其解释为 zip,而其他浏览器会将包解释为内容。

仔细查看网络选项卡中的 'content-length' 属性(在 chrome 与 firefox 调试器中),您可能会发现它有所不同。 chrome 收到的文件的内容长度是 chrome 下载的一半。这很奇怪,因为两个 apk 文件显示的大小相同(以千字节为单位)。

我们的开发人员目前正在研究通过 Wildfly 服务器以不同的方式提供文件