4

For a client I build a private app which their employees can download on their tablet and use. To get the app, the employee opens Chrome on his tablet and navigates to an URL to start the .apk download.

This approach worked fine for the last few years, till a few weeks ago. Instead of installing the app, a folder is shown with the files of the .apk.

The only difference I noticed is the source that's stated in the 'Downloads' screen. On June 16th everything worked fine, the source says 'chrome-native://newtab'. As of July 1th, the source changed to the domain where the .apk was downloaded and this problem occurs:

The tablets are only used for this particular app. The company buys a tablet, navigates to the URL, downloads the .apk and installs it. It would like to keep it as simple as this.

I've searched everywhere, but still have no clue what causes this problem. Any ideas?

This problem occurs on Android 8.1.0, the upgrade form 8.0.0 to 8.1.0 may be the cause of the problem. But I still have no idea how to solve it.

2 Answers 2

2

The issue happens with an incorrect HTTP header.

If the request has the right Content-Type header: application/vnd.android.package-archive, the APK will be installed correctly.

1
  • Hi, glad to know that you found the solution by yourself! Considering Android Enthusiasts Stack Exchange actually focuses on Android end-users (who are not necessarily developers), I'll try to reword the explanation for more end-users friendly. Feel free to edit and correct/improve it, thanks!
    – Andrew T.
    Dec 11, 2020 at 8:13
0

I just had the same problem and was looking for an explanation.

If you tap on an .apk in that list a message (Toast) pops up saying it can't open the file, right?

A workaround I found is to open the file explorer app and manually navigate to the Downloads folder and tap on the .apk there. You'll be able to install the app without issues.
Or you can just use another browser, like Firefox.

My guess is that Google restricts Chrome from opening APKs. Funny enough you have to explicitly allow Chrome to download APKs but now you can't install them anymore… Still trying to wrap my head around this.

I'll edit this answer if I find out more.

2
  • @Thijs Thank You, you've taken me in the right direction. A colleague set application/apk by mistake. However it only solved another problem (download not working), the problem with Chrome still persists. Do you know where else we need to set the Content-Type? We only added the MIME-Type in our IIS-Server. The APK is generated via the usual Android Studio function. It's the same with debug or signed release versions. One more thing i just noticed: Downloading it from a site works (virtual IIS directory, clicking on file), but opening a direct link to the apk seems to cause the problem.
    – Alex
    Dec 5, 2019 at 8:34
  • Okay, thanks nonetheless. I really think it has something to do with the latest Chrome version or Android security. Because it works with every other browser or file explorer. Just not with the Chrome- or Downloads-App. I'll leep an eye on this.
    – Alex
    Dec 16, 2019 at 11:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .