HomeAppium

INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling

Like Tweet Pin it Share Share Email

When you are at final step to execute test automation script for mobile app testing on a mobile emulator or a virtual device or a real device, you might observe that script execution fails with different kinds of errors, In context to current article you will look at the error and solutions for: INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.

Error in Appium Server:

Error: Command failed: C:\Windows\system32\cmd.exe /s /c 
"C:\Users\{User}\AppData\Local\Android\sdk\platform-tools\adb.exe -s 
emulator-5554 install 
"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk""

> Failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\
settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install 
io.appium.settings without first uninstalling.]

Error in Android studio run console:

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. 
(Original error: Command failed: C:\Windows\system32\cmd.exe /s /c 
"C:\Users\{User}\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 install 
"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk""
Failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\
settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install 
io.appium.settings without first uninstalling.]
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds

For the first time when you execute the script it might pass, but it will fail with above error when you try to execute the same or any other script multiple times. Or when your test script execution fails on the first attempt for some other reason, and when you fix it and execute it again, you might encounter this new issue.

The reason for this error is that Appium installs 2 mobile applications before executing the script.

1. io.appium.settings

2. io.appium.unlock

These are the supportive mobile applications appium utilizes to execute the test automation script in Mobile Emulator or virtual device or a real mobile device.

Ideally Appium should remove these files every time at the end of the script execution or termination, if it is intends to install them every time a script is executed, or it should conditionally install these apps / apks to the mobile emulator or mobile device.

In your mobile emulator / Virtual Device / Real device, the 2 mobile applications appear as below:

There are multiple ways to troubleshoot this error and go ahead for a successful test script execution.

Solution 1: ADB’s uninstall command to remove the files.

You can open command prompt, assuming that you already had set the environment variables for ANDROID_HOME and Path variables for sdk tools and platform tools.

And execute commands as shown below:

Solution 2: Uninstall manually

You can open the mobile emulator / virtual device / real device and go to apps and uninstall them.

Solution 3: Write code as part of your test automation script.

As part of your selenium test automation script, you could write instructions to execute the commands provided in solution 1 above, so that this issue would not arise.

Hope this article has been helpful and you are able to proceed further with script execution.

Request to kindly share any of your queries in form of comments, we would try our best to provide any solution for you.

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *