2016-05-31 58 views
1

我已经设置了新的 Xamarin.Forms项目。我想构建它并将其部署到模拟器或Android设备,但它不起作用。在Visual Studio的Outputwindow,显示以下错误:Xamarin部署不适用于Android

The application could not be started. Ensure that the application has been installed to the target device and has a launchable activity (MainLauncher = true).

更新:

如果我看在构建日志我可以找到以下内容:

2>Mono.AndroidTools.InstallFailedException: Unexpected install output: Error: Could not access the Package Manager. Is the system running?

2> bei Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)

2> bei Mono.AndroidTools.AndroidDevice.c__AnonStoreyD.<>m__0(Task`1 t)

2> bei System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()

2> bei System.Threading.Tasks.Task.Execute()

2>Deployment failed because of an internal error: Unexpected install output: Error: Could not access the Package Manager. Is the system running?

+0

现在我又遇到了同样的问题:) –

回答

6

您需要首先将Android项目设置为启动项目。 右键单击Android项目并选择设置为启动项目

确保您已经检查了构建和部署复选框。 您可以右键单击解决方案并选择配置管理器


另外,请确保模拟器已经运行

您需要等待模拟器完全启动 - 大约需要几分钟时间。一旦它完全启动(模拟器上的UI将改变),它应该工作。

您将需要在模拟器运行后重新启动应用程序并选择正在运行的模拟器(出现提示时)。

+0

我听说过这个问题,但我检查了这个。请看问题,有新的信息。 –

+0

模拟器仍在启动时,通常会发生此错误。确保模拟器已经在运行。 –

+0

谢谢你的帮助。现在,如果模拟器正在运行,我可以启动该应用程序。 –

3

这可能是由几件事引起的。当我得到这个时,我将输出窗口下拉菜单切换到Build。通常会显示某种INCOMPATIBLE错误。这通常意味着设备/模拟器上的应用程序安装被破坏/以某种方式搞砸了。该应用程序可能甚至不会显示在应用程序仪表板区域,但如果你进入设置 - >应用程序(或应用程序管理器) - >然后寻找应用程序的应用程序ID(不是应用程序的名称)。当您找到它时,请将其卸载并重试。

我错误的另一个常见原因是在Android项目属性中没有选择正确的体系结构。尝试在Xamarin Android Player上运行时通常就是这种情况。为了解决这个问题,右键单击Xamarin Android项目 - >属性 - > Android选项 - >高级 - >选择x86

+0

感谢您的提示;-)。请看问题,有新的信息。 –

相关问题