无法将APK安装到设备

时间:2019-03-25 12:21:07

标签: android unity3d sdk apk

我更新了我的jdk和sdk,并且在进行构建apk时正在构建但无法正常工作。 通过USB调试,我收到此错误。我正在使用Unity 2018.3.9f1。请解决问题。

在Unity 5.6.6 APK中,构建成功。

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.
D:/Babji Unity/android-sdks\platform-tools\adb.exe -s "cbe79ceb" install -r "D:\Babji Unity\Test New Unity\TestAsset.apk"

stderr[
adb: failed to install D:\Babji Unity\Test New Unity\TestAsset.apk: Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed to parse /data/app/vmdl839836997.tmp/base.apk: AndroidManifest.xml]
]
stdout[
Performing Streamed Install
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.ADB.RunInternal (System.String[] command, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.ADB.Run (System.String[] command, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.AndroidDevice.Exec (System.String[] command, System.String errorMsg) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.AndroidDevice.Install (System.String apkfile) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.AndroidDeploymentTargetsExtension+<UploadAPK>c__AnonStorey3.<>m__0 () (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.AndroidDeploymentTargetsExtension.UploadAPK (UnityEditor.Android.AndroidBuildProperties buildProperties, UnityEditor.Android.AndroidDevice device, UnityEditor.Android.AndroidDeploymentTargetsExtension+LaunchProgressTaskManager taskManager) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.AndroidDeploymentTargetsExtension+<LaunchBuildOnTarget>c__AnonStorey0.<>m__2 () (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.ProgressTaskManager.Run () (at C:/buildslave/unity/build/Editor/Mono/Utils/ProgressBarUtils.cs:71)
UnityEditor.Android.AndroidDeploymentTargetsExtension.LaunchBuildOnTarget (UnityEditor.DeploymentTargets.IDeploymentTargetsMainThreadContext context, UnityEditor.BuildProperties buildProperties, UnityEditor.DeploymentTargets.DeploymentTargetId targetId, UnityEditor.ProgressHandler progressHandler) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.DeploymentTargets.DeploymentTargetManager.LaunchBuildOnTarget (UnityEditor.BuildProperties buildProperties, UnityEditor.DeploymentTargets.DeploymentTargetId targetId, UnityEditor.ProgressHandler progressHandler) (at C:/buildslave/unity/build/Editor/Mono/DeploymentTargets/DeploymentTargetManager.cs:45)
UnityEditor.PostprocessBuildPlayer+<LaunchOnTargets>c__AnonStorey1.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:210)
UnityEditor.ProgressTaskManager.Run () (at C:/buildslave/unity/build/Editor/Mono/Utils/ProgressBarUtils.cs:71)
UnityEditor.PostprocessBuildPlayer.LaunchOnTargets (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget buildTarget, UnityEditor.Build.Reporting.BuildReport buildReport, System.Collections.Generic.List`1[T] launchTargets) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:229)
UnityEditor.Android.PostProcessAndroidPlayer.Launch (UnityEditor.BuildTarget target, System.String installPath, UnityEditor.Build.Reporting.BuildReport report) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.AndroidBuildPostprocessor.LaunchPlayer (UnityEditor.Modules.BuildLaunchPlayerArgs args) (at <df7ba4d130594d168eec372b930522d4>: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 C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:173)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

4 个答案:

答案 0 :(得分:1)

尝试卸载已安装的APK。

答案 1 :(得分:0)

我找到了解决方案。

在任何其他驱动器中创建新文件夹,然后将文件夹从旧的SDK逐个复制到新的SDK文件夹,并在每次粘贴该文件夹时进行构建。

在我的情况下,有一个额外的文件夹已损坏并发现是这样的,我删除了该文件夹,现在可以正常工作了。

答案 2 :(得分:0)

您应该删除以前安装的应用程序,并使用该软件清理其余的应用程序。

这似乎是以前安装的应用程序,导致缓存无法继续。

我尝试了很多方法,最简单的解决方法是重启手机或虚拟机

答案 3 :(得分:0)

在“构建设置”中单击“构建并运行”后,我在将APK安装到设备上时遇到问题。构建成功完成,但是出现了错误Unable to install APK to device,但已通过更新Unity Hub得以解决。在Unity Hub菜单中,顶部有一条通知,说有可用的更新。更新Unity Hub之后,我能够安装APK并成功在手机上运行游戏。