1. 程式人生 > >Xamarin For Visual Studio第二坑

Xamarin For Visual Studio第二坑

Xamarin專案單獨生成已經通過,但是啟動自定義的虛擬機器測試(在Visual Studio介面下)卻發生錯誤,提示為:

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

而更早時使用預設虛擬機器(AVD_GalaxyNexus_ToolsForApacheCordova那個)報錯則為:System.AggregateException: 發生一個或多個錯誤。 ---> Xamarin.AndroidTools.AndroidDeploymentException: InternalError ---> Mono.AndroidTools.AdbException: No such file or directory

好吧,這個錯誤在網上找不到答案,至少我沒找到。Logcat也沒看到有用的資訊。

其實原因是:你的虛擬機器啟動太慢啦!虛擬機器沒啟動起來,當然無法部署,從而引發找不到檔案或資料夾的錯誤。

解決:先通過AVD Manager手動啟動測試虛擬機器,完成啟動後再到Visual Studio中點選除錯按鈕,過一會兒你就會看到Xamarin提供的那個HelloAndroid示例的執行結果了。(不過我預設的AVD_GalaxyNexus_ToolsForApacheCordova一直無法啟動,自定義的一個和預設自帶的Android_ARMv7a API 23這個則啟動成功。)