Update APK on phone without removing the old version

Unity Version: 2017.3.1f1

Hi guys,

I am currently running into a problem: Unity fails to install the APK on my Galaxy S7 with the following error message: “CommandInvokationFailure: Unable to install APK to device. Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details.”

Previously, I have been testing my game on a Galaxy Alpha, which automatically updated the APK on the phone. In order to solve my problem, I have to remove the previously installed APK and then build the new APK, which is a little bit more work each time.

Is there a way to update the installed APK on the S7 instead of removing the old APK each time?

Best wishes

Have you check Editor.log what is exactly the error?

CommandInvokationFailure: Unable to install APK to device. Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details.
C:/Users/Kjell Bunjes/AppData/Local/Android/Sdk\platform-tools\adb.exe -s "ce12160cf1d08f1701" install -r "D:\Entwicklung\OmegaPort\OmegaPort\test.apk"

stderr[
adb: failed to install D:\Entwicklung\OmegaPort\OmegaPort\test.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.test.bunjes signatures do not match the previously installed version; ignoring!]
]
stdout[

]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.ADB.RunInternal (System.String[] command, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.ADB.Run (System.String[] command, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidDevice.Exec (System.String[] command, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidDevice.Install (System.String apkfile, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.AndroidDeploymentTargetsExtension+<UploadAPK>c__AnonStorey2.<>m__0 ()
UnityEditor.Android.AndroidDeploymentTargetsExtension.UploadAPK (UnityEditor.BuildReporting.BuildReport buildReport, UnityEditor.Android.AndroidDevice device, UnityEditor.ProgressTaskManager taskManager)
UnityEditor.Android.AndroidDeploymentTargetsExtension+<LaunchBuildOnTarget>c__AnonStorey1.<>m__0 ()
UnityEditor.ProgressTaskManager.Run () (at C:/buildslave/unity/build/Editor/Mono/Utils/ProgressBarUtils.cs:71)
UnityEditor.Android.AndroidDeploymentTargetsExtension.LaunchBuildOnTarget (UnityEditor.BuildReporting.BuildReport buildReport, DeploymentTargetId targetId, UnityEditor.ProgressHandler progressHandler)
UnityEditor.DeploymentTargets.DeploymentTargetManager.LaunchBuildOnTarget (BuildTargetGroup targetGroup, UnityEditor.BuildReporting.BuildReport buildReport, DeploymentTargetId targetId, UnityEditor.ProgressHandler progressHandler) (at C:/buildslave/unity/build/Editor/Mono/DeploymentTargets/DeploymentTargetManager.cs:36)
UnityEditor.PostprocessBuildPlayer+<Launch>c__AnonStorey0.<>m__1 () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:181)
UnityEditor.ProgressTaskManager.Run () (at C:/buildslave/unity/build/Editor/Mono/Utils/ProgressBarUtils.cs:71)
UnityEditor.PostprocessBuildPlayer.Launch (BuildTargetGroup targetGroup, BuildTarget buildTarget, System.String path, System.String productName, BuildOptions options, UnityEditor.BuildReporting.BuildReport buildReport) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:197)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

So, the signatures are not matching. I have never changed them at any point in the project since the project setup, though.

Best wishes

Probably something has changed in AndroidManifest.xml or you sign with different keystore now.

Wouldn’t that imply that once I’ve installed a new version (and removed the old version) on my S7 device results in the error not occuring any longer and Unity being able to update it properly? I’m asking, because this is not the case. I have to manually de-install my app from my S7 every time before I can build again while it works on other devices just fine without de-installing.

Best wishes

Do you sign with a debug key or do you provide your own key to sign the app? Does this happen with a new / empty project or only with that one project?

Yes, I am using a debug key. No, this does not happen with an empty project, only with my current project.

Best wishes

Jumping in on this thread, just to clarify - updating ALWAYS FAILS?

For example, when running the following steps, step #3 fails ?

  1. Start from a clean state (game is not installed)
  2. Build and run from Unity.
  3. After game runs, build and run again.

Exactly. This behaviour does not occur when I’m using my Galxy S Alpha or S5.

Update: Today I installed the latest update on the Galaxy S7 and this solved the issue.