Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APK installation limits outside of Google Store

Tags:

android

apk

adb

I want to create a large app, for distribution to a specific set of users outside of the Play Store. I intend to install this via ADB however i cannot find hard info on size limits.

I created a simple test apk and dumped 1.8GB of content into the assets folder. ADB throws the following error:

could not allocate buffer for 'sizetest.apk'

I have tried this on a device with 7Gb of free space, so I am wondering what end this error comes from. Is it the device storage / system storage / device memory / my pc memory / ADB itself and is there a workaround?

like image 573
Leonard Feehan Avatar asked Oct 04 '22 06:10

Leonard Feehan


1 Answers

This was a problem with ADB. ADB use to verify that the file was an APK and read the entire file into memory before installation. This could cause mallac to return NULL, closing your ADB session (see file_sync_client.c lines 335-341).

This was fixed here.

Remove support for verifying APK before sending across wire, since it was reading the entire APK into memory (!) before sending.


I created a simple hello world project and created a large file (1.8 GB) and added the file to assets. ADB successfully installed the APK on my device.

As long as there is enough free space on the device, the APK should be installable. If you are still getting the error could not allocate buffer for 'APK', then update adb.

DEX limits:

The only size limitation I know of is the size of your dex file. If a dex file (classes.dex in your APK) exceeds 5 MB and needs to be installed on Froyo or Gingerbread then installation will fail. Recent versions of Android use an 8 or 16 MB buffer. You can use multidex to fix this issue. However, you probably won't need to worry about the size of your dex file (more info).

like image 106
Jared Rummler Avatar answered Oct 07 '22 19:10

Jared Rummler