UnityException: Could not find any valid targets to launch on for Android

I was developing an Android build in Unity3D, but when I tried to build it for andriod platfrom, it gave me an error (given below). Despite enabling USB debugging in the Developer Options on my mobile, I encountered the following exceptions or errors in Unity console during build and run.

Build & Run Error

Below is the error log, which I got when I tried to build for android platform:

Installation failed with the following output:

adb: failed to install D:\@Learning\ProTrainingByUnity\ARTut\APK\testing.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)


DeploymentOperationFailedException: Installation failed. See the Console for details.

UnityEditor.Android.AndroidDeploymentTargetsExtension.UploadAPK (UnityEditor.Android.AndroidBuildProperties buildProperties, UnityEditor.Android.AndroidDevice device, UnityEditor.Android.AndroidDeploymentTargetsExtension+LaunchProgressTaskManager taskManager) (at <e0f86d9fe11d48b2b406f2dbac04ce1b>:0)

UnityEditor.Android.AndroidDeploymentTargetsExtension+<>c__DisplayClass15_1.<LaunchBuildOnTarget>b__3 () (at <e0f86d9fe11d48b2b406f2dbac04ce1b>:0)

UnityEditor.ProgressTaskManager.Run () (at <1899c5bd2a6d466081cd705bee01d689>:0)

UnityEditor.Android.AndroidDeploymentTargetsExtension.LaunchBuildOnTarget (UnityEditor.DeploymentTargets.IDeploymentTargetsMainThreadContext context, UnityEditor.BuildProperties buildProperties, UnityEditor.DeploymentTargets.DeploymentTargetId targetId, UnityEditor.ProgressHandler progressHandler) (at <e0f86d9fe11d48b2b406f2dbac04ce1b>:0)

UnityEditor.DeploymentTargets.DeploymentTargetManager.LaunchBuildOnTarget (UnityEditor.BuildProperties buildProperties, UnityEditor.DeploymentTargets.DeploymentTargetId targetId, UnityEditor.ProgressHandler progressHandler) (at <1899c5bd2a6d466081cd705bee01d689>:0)

UnityEditor.PostprocessBuildPlayer+<>c__DisplayClass22_1.<LaunchOnTargets>b__1 () (at <1899c5bd2a6d466081cd705bee01d689>:0)

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)


UnityException: Could not find any valid targets to launch on for Android

UnityEditor.PostprocessBuildPlayer.LaunchOnTargets (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget buildTarget, UnityEditor.Build.Reporting.BuildReport buildReport, System.Collections.Generic.List`1[T] launchTargets) (at <1899c5bd2a6d466081cd705bee01d689>:0)

UnityEditor.Android.PostProcessAndroidPlayer.Launch (UnityEditor.BuildTarget target, System.String installPath, UnityEditor.Build.Reporting.BuildReport report) (at <e0f86d9fe11d48b2b406f2dbac04ce1b>:0)

UnityEditor.Android.AndroidBuildPostprocessor.LaunchPlayer (UnityEditor.Modules.BuildLaunchPlayerArgs args) (at <e0f86d9fe11d48b2b406f2dbac04ce1b>: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 <1899c5bd2a6d466081cd705bee01d689>:0)

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)


UnityException: Could not find any valid targets to launch on for Android

Solution

It turns out that you also need to enable the 'Install via USB' option in your Android phone which is Under the Developer option. So if you encounter the same error, give this solution a try.


Enabling USB debugging is not sufficient, you have to allow Install via USB option as well.

Post a Comment

0 Comments