Reputation: 1
Im working on game develop in Unity. I want to make a game of Android. I downloaded the jdk, spk, etc.
I followed exacly how the videos told me but when I connect my Android to the game and click on "Build And Run" I get the error in the end of the process: Failed to build APK!.
The console shows:
OperationFailedException: Installation failed. See the Console for details. UnityEditor.Android.AndroidDeploymentTargetsExtension.UploadAPK (UnityEditor.BuildReporting.BuildReport buildReport, UnityEditor.Android.AndroidDevice device, UnityEditor.ProgressTaskManager taskManager) UnityEditor.Android.AndroidDeploymentTargetsExtension+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+c__AnonStorey0.<>m__1 () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:181) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
What could be the problem?
Upvotes: 0
Views: 1065
Reputation: 125315
There are many reasons why this error can appear. Here are the most four known reasons why this is happening(arranged from very likely to unlikely order):
1.Your Minimum API Level in Unity is set to a higher API level than the actual version of your device/phone.
Go to Edit --> Project Settings --> Player --> Other Settings --> Identification --> Minimum API Level then change that to match your OS version.
2.Unity is trying to install your apk in a location you don't have permission to write to.
Go to Edit --> Project Settings --> Player --> Other Settings --> Configuration --> Install Location then change that to Automatic.
If build doesn't work, try the Prefer External
then Force Internal
. If none of them worked, roll back to Automatic
as that is recommended option.
3.There is already app with the-same package name installed on your device. Consider changing your package name.
Go to Edit --> Project Settings --> Player --> Other Settings --> Identification --> Package Name then change that to new name.
You can also remove/uninstall the app from your device first.
4.Your device hardware/peripheral
It is harder to fix this issue when #1 to #3 did not solve it. The problem is now likely your device or any peripherals you are using. Here are the possible reasons and fix:
A.USB cable. - Try another cable.
B.USB hub on your computer- Try another one on the computer.
C.Battery. - A defective battery can also cause this. If the battery is swollen then it extreme likely that this is the issue. Replace the battery if you notice this.
D. Corrupted storage. - This happens sometimes and it is the problem, perform hard reset on the Android device.
Upvotes: 1