2016-05-31 64 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

感謝您的提示;-)。請看問題,有新的信息。 –

相關問題