Gettin error installing io.appium.uiautomator2

Hello guys. I have an error during test launch that provokes a completely fail of the test. I don’t understand why it happens if when I check the device still has 22GB of memory free. And after I reboot the system it works again

The issue is:
MCSClientApp Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command '/opt/android-sdk/platform-tools/adb -P 5037 -s A75149FRCNBCVZW00C9 install -r --no-incremental /home/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' exited with code 1'; Command output: adb: failed to install /home/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE: Scanning Failed.: Package io.appium.uiautomator2.server.test could not be assigned a valid UID]

Here is attached the log from appium
appiumServerLogs.log (17.2 KB)

Did you check fee space on phone?

As I mention in the post I check the free space on the device and at the time it was having 22GB of free space.

  1. you may try same command yourselve
  2. try also first remove app you trying to install from phone (just for sure)
  3. maybe you have different free spaces on phone e.g. on SDcard while app need to install into main memory

That’s a known limitation feature of Android OS. It has a hardcoded limit of 10_000 installs (it creates a unique application user for each install with a unique UID). After this limit expires it shows the above error message, where the error code itself is very confusing, but the second part does make sense, and basically means the limit of 10000 installs has expired, so the OS cannot assign a new user UID to any newly installed app.

The only known workaround is to reboot the phone. Also, since Android OS only creates a new user if a full app reinstall happens (e.g. uninstall and then install), then it makes sense to avoid uninstalling apps on a regular basis. Instead, one may consider to clear their data or perform reinstall/upgrade with -r option enabled.

2 Likes