Android Studio: adb – INSTALL_FAILED_INSUFFICIENT_STORAGE
Tags: operatingsystems, troubleshooting, unixlinux, android
Published: 2019-03-04 15:37:57

---
title: Android Studio: adb – INSTALL_FAILED_INSUFFICIENT_STORAGE
published: true
tags: Operating systems,Troubleshooting,UNIX/Linux,Android
canonical_url: https://rtfm.co.ua/en/android-studio-adb-install_failed_insufficient_storage-2/
---

![](https://rtfm.co.ua/wp-content/uploads/2018/11/logo-androidstudio.png)Proceeding fighting with our UI auto-tests ![🙂](https://s.w.org/images/core/emoji/11.2.0/72x72/1f642.png)

Two previous posts were really useful this time – [Android Studio: установка на Linux и работа с Android Virtual Devices](https://rtfm.co.ua/android-studio-ustanovka-na-linux-i-rabota-s-android-virtual-devices/) and [Appium: Android Virtual Device, Original error: Condition unmet after 60159 ms и костыль](https://rtfm.co.ua/appium-android-virtual-device-original-error-condition-unmet-after-60159-ms-i-kostyl/).

In general – tests works fine but sometimes gives me interesting issues.

This time out QA-engineer sent me the new error to our Slack:

```
[debug] [W3C] Encountered internal error running command: Error executing adbExec. Original error: 'Command '/android/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 install -r -g /home/projectname/projectnameMenBuilds/projectnameMen-stage.apk' exited with code 1'; Stderr: 'adb: failed to install /home/projectname/projectnameMenBuilds/projectnameMen-stage.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]'; Code: '1'
[debug] [W3C] Error: Command '/android/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 install -r -g /home/projectname/projectnameBuilds/projectnameMen-stage.apk' exited with code 1
[debug] [W3C]     at ChildProcess.proc.on.code (/home/projectname/node_modules/teen_process/lib/exec.js:94:19)
[debug] [W3C]     at emitTwo (events.js:126:13)
[debug] [W3C]     at ChildProcess.emit (events.js:214:7)
[debug] [W3C]     at maybeClose (internal/child_process.js:925:16)
[debug] [W3C]     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
[HTTP] <-- POST /wd/hub/session 500 2312 ms - 1165
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP]
```

The first conspicuous message – “**_Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]’; Code: ‘1’_**“.

On the first Google request with the “_android INSTALL_FAILED_INSUFFICIENT_STORAGE_” I found [this>>>](https://stackoverflow.com/questions/4709137/solution-to-install-failed-insufficient-storage-error-on-android) question on the StackOverflow and one answer there, describing almost the same issue – [here>>>](https://stackoverflow.com/a/8105497/2720802).

Let’s check.

Run the emulator used in tests:

```
projectname@projectname-ci:~$ emulator -avd Nexus_5X_API_26
```

Run shell in there:

```
projectname@projectname-ci:~$ adb shell
generic_x86:/ $
```

Check available space:

```
1|generic_x86:/ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          611M  4.6M  606M   1% /
tmpfs           756M  488K  756M   1% /dev
/dev/block/vda1 2.4G  1.4G  0.9G  59% /system
/dev/block/vde1  90M   35M   53M  40% /vendor
tmpfs           756M     0  756M   0% /mnt
/dev/block/vdb   61M   56K   60M   1% /cache
/dev/block/dm-0 1.9G  1.7G  148M  93% /data
/data/media     1.9G  1.7G  148M  93% /storage/emulated
```

_148M 93% /data_ – 148 MB, obviously not too much.

Haven’t looked at the apk-file with our application used, but anyway – too low free space.

Try to check the `/data` content:

```
1|generic_x86:/ $ ls -l /data/
ls: /data/: Permission denied
```

Aha…

Try with the root:

```
projectname@projectname-ci:~$ adb root
adbd cannot run as root in production builds
```

Well – okay. There are solutions about how to get root access – but I don’t want to waste time now for it.

Just will increase disk used for this device – there is enough available space on the build-host.

Next Google search with the “_android emulator disk space_“, led me to the [Quick Tip: Increase the storage size of your Android Emulator](https://www.appcelerator.com/blog/2013/04/quick-tip-increase-the-storage-size-of-your-android-emulator/) post.

Find device’s directory used:

```
projectname@projectname-ci:~$ ls -l ~/.android/avd/
total 16
drwxrwxr-x 5 projectname projectname 4096 бер  4 11:35 Nexus_5X_API_26.avd
-rw-rw-r-- 1 projectname projectname  127 лис 20 17:50 Nexus_5X_API_26.ini
drwxrwxr-x 4 projectname projectname 4096 гру 18 18:44 test.avd
-rw-rw-r-- 1 projectname projectname  105 лис 19 17:18 test.ini
```

And the `~/.android/avd/Nexus_5X_API_26.avd`:

```
projectname@projectname-ci:~$ ls -la ~/.android/avd/Nexus_5X_API_26.avd/
total 2861472
drwxrwxr-x 5 projectname projectname       4096 бер  4 11:35 .
drwxrwxr-x 4 projectname projectname       4096 бер  4 11:41 ..
-rw-rw-r-- 1 projectname projectname         96 бер  4 11:35 AVD.conf
-rw-r--r-- 1 projectname projectname   69206016 бер 12  2018 cache.img
-rw-r--r-- 1 projectname projectname   42598400 бер  4 11:35 cache.img.qcow2
-rw-rw-r-- 1 projectname projectname       1173 лют 14 11:10 config.ini
```

Here is the `config.ini` mentioned in the post above:

```
projectname@projectname-ci:~$ cat ~/.android/avd/Nexus_5X_API_26.avd/config.ini | grep data
disk.dataPartition.size=2G
```

Set a new value here, let’s say – 5 GB:

```
...
disk.dataPartition.size=5G
...
```

Run an emulator again:

```
projectname@projectname-ci:~$ emulator -avd Nexus_5X_API_26
emulator: WARNING: userdata partition is resized from 2048 M to 5120 M
```

Shell:

```
projectname@projectname-ci:~$ adb shell
error: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
```

Er… Okay – kill the`avd`:

```
projectname@projectname-ci:~$ adb kill-server
```

And shell again:

```
projectname@projectname-ci:~$ adb shell
* daemon not running; starting now at tcp:5037
* daemon started successfully
```

Check disk space now:

```
generic_x86:/ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          611M  4.6M  606M   1% /
tmpfs           756M  488K  756M   1% /dev
/dev/block/vda1 2.4G  1.4G  0.9G  59% /system
/dev/block/vde1  90M   35M   53M  40% /vendor
tmpfs           756M     0  756M   0% /mnt
/dev/block/vdb   61M   56K   60M   1% /cache
/dev/block/dm-0 4.8G   88M  4.7G   2% /data
/data/media     4.8G   88M  4.7G   2% /storage/emulated
```

Run tests – and everything works now.


### Similar posts
 
- <small>12/06/2018</small> [Appium: Android Virtual Device, Original error: Condition unmet after 60159 ms и костыль](https://rtfm.co.ua/appium-android-virtual-device-original-error-condition-unmet-after-60159-ms-i-kostyl/)<small> (0)</small>  
- <small>11/21/2018</small> [Android Studio: установка на Linux и работа с Android Virtual Devices](https://rtfm.co.ua/android-studio-ustanovka-na-linux-i-rabota-s-android-virtual-devices/)<small> (0)</small>  
- <small>12/12/2018</small> [Android Studio: emulator – qt_setup.cpp:28:Qt library not found](https://rtfm.co.ua/android-studio-emulator-qt_setup-cpp28qt-library-not-found/)<small> (0)</small>  
- <small>03/01/2019</small> [Linux: systemd-unit files edit, restart on failure and email notifications](https://dev.to/setevoy/linux-systemd-unit-files-edit-restart-on-failure-and-email-notifications-5h3k)<small> (0)</small>