Search Unity

CommandInvokationFailure: Unable to install APK to device

Discussion in 'Getting Started' started by unity_agCykIER1HrfIQ, Mar 23, 2021.

  1. unity_agCykIER1HrfIQ

    unity_agCykIER1HrfIQ

    Joined:
    Mar 14, 2018
    Posts:
    4
    Hello all,

    Last week I was attempting to utilize Firebase with my game. I downloaded some google files, and messed around a little bit with them, and momentarily got it working. However, I don't exactly remember what my next steps were, other than their result is this error message.

    To clarify, I have tried the following steps (I am on Windows 10):
    1) Updated Unity Hub
    2) Uninstalled and reinstalled unity versions (2019.4.22f1 and 2020.2.7f1). This project is on 2019.4.22f1
    3) Uninstalled and reinstalled Android Studio
    4) Updated all the SDKs through Android Studio

    I have read through this error message and can't quite figure out the problem. Could I get another pair of eyes on this? The best I can come up with is to "fix" my SDK files, but I have no idea how to or where to do that.

    ERROR HERE:

    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:/Program Files/Unity/Hub/Editor/2019.4.22f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK\platform-tools\adb.exe -s "NIWA430091" install -r -d "C:\Users\[USERNAME]\Desktop\Important Stuff\Unity\Stardrive_Characters\Builds\AndroidBuild\Stardrive_C_vdot1.apk"

    stderr[
    adb: failed to install C:\Users\[USERNAME]\Desktop\Important Stuff\Unity\Stardrive_Characters\Builds\AndroidBuild\Stardrive_C_vdot1.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.BesonamyStudios.stardrivecharacters signatures do not match the previously installed version; ignoring!]
    ]
    stdout[

    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.Android.ADB.RunInternal (System.String[] command, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.Android.ADB.Run (System.String[] command, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.Android.AndroidDevice.Exec (System.String[] command, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.Android.AndroidDevice.Install (System.String apkfile) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.Android.AndroidDeploymentTargetsExtension+<>c__DisplayClass16_0.<UploadAPK>b__0 () (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.Android.AndroidDeploymentTargetsExtension.UploadAPK (UnityEditor.Android.AndroidBuildProperties buildProperties, UnityEditor.Android.AndroidDevice device, UnityEditor.Android.AndroidDeploymentTargetsExtension+LaunchProgressTaskManager taskManager) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.Android.AndroidDeploymentTargetsExtension+<>c__DisplayClass12_1.<LaunchBuildOnTarget>b__2 () (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.ProgressTaskManager.Run () (at <4a1b55d6b009421a9ad1d16b54b782d5>:0)
    UnityEditor.Android.AndroidDeploymentTargetsExtension.LaunchBuildOnTarget (UnityEditor.DeploymentTargets.IDeploymentTargetsMainThreadContext context, UnityEditor.BuildProperties buildProperties, UnityEditor.DeploymentTargets.DeploymentTargetId targetId, UnityEditor.ProgressHandler progressHandler) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.DeploymentTargets.DeploymentTargetManager.LaunchBuildOnTarget (UnityEditor.BuildProperties buildProperties, UnityEditor.DeploymentTargets.DeploymentTargetId targetId, UnityEditor.ProgressHandler progressHandler) (at <4a1b55d6b009421a9ad1d16b54b782d5>:0)
    UnityEditor.PostprocessBuildPlayer+<>c__DisplayClass19_1.<LaunchOnTargets>b__1 () (at <4a1b55d6b009421a9ad1d16b54b782d5>:0)
    UnityEditor.ProgressTaskManager.Run () (at <4a1b55d6b009421a9ad1d16b54b782d5>:0)
    UnityEditor.PostprocessBuildPlayer.LaunchOnTargets (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget buildTarget, UnityEditor.Build.Reporting.BuildReport buildReport, System.Collections.Generic.List`1[T] launchTargets) (at <4a1b55d6b009421a9ad1d16b54b782d5>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.Launch (UnityEditor.BuildTarget target, System.String installPath, UnityEditor.Build.Reporting.BuildReport report) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.LaunchPlayer (UnityEditor.Modules.BuildLaunchPlayerArgs args) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
    UnityEditor.PostprocessBuildPlayer.Launch (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget buildTarget, System.String path, System.String productName, UnityEditor.BuildOptions options, UnityEditor.Build.Reporting.BuildReport buildReport) (at <4a1b55d6b009421a9ad1d16b54b782d5>:0)
     
  2. Roman_34

    Roman_34

    Joined:
    Nov 1, 2018
    Posts:
    19
    So there is no solution?!?
    I got a similar 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.
    E:/UnityHub/2019.4.31f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK\platform-tools\adb.exe -s "741f070b" install -r -d "E:\Unity\projects\***.apk"
    stderr[
    adb: failed to install E:\Unity\projects\***.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Invalid apk]
    ]
    stdout[
    ]

    What could be the problem?
     
  3. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    Are you using a Windows admin account? Do you have permission from whoever is in charge of the admin account to download/install stuff?
     
  4. Roman_34

    Roman_34

    Joined:
    Nov 1, 2018
    Posts:
    19
    Yes, I am admin.
    Another person also cannot put the created apk file on their phone. With error: "There was a problem parsing the package."
     
  5. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    Sounds like creating the APK didn't work properly, build it again and try and put it on your phone.
     
  6. Roman_34

    Roman_34

    Joined:
    Nov 1, 2018
    Posts:
    19
    I've done this many times :)) Trying different Unity settings and phone developer settings.
    Some problem in the manifest file. But I don't understand how to find out which one?
     
  7. Roman_34

    Roman_34

    Joined:
    Nov 1, 2018
    Posts:
    19
    I solved this problem!!!
    I added field android:exported="true" in AndroidManifest.xml in Unity project (Assets\Plugins\Android\AndroidManifest.xml).
     
  8. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    Well done! See? You can figure stuff out yourself if you use your brains.

    I don't mean that to be as insulting as it probably sounds, on the contrary, it's a compliment.
     
  9. Roman_34

    Roman_34

    Joined:
    Nov 1, 2018
    Posts:
    19

    I'm porting for Android for the first time. Before that, I did not encounter development for it.
    I was prompted to look for a solution here: https://forum.unity.com/threads/not...gle-play-android-exported-android-12.1224948/
    They suggested that this might be the reason.
    Perhaps this solution will help someone else.