0

當我嘗試在xamarin-android應用程序上運行單元測試時,所有測試都失敗,因爲IDE(VS 2015)找不到任何設備或模擬器來部署應用程序,儘管一個正在運行。Xamarin IDE集成未能部署應用程序

如果我通常運行應用程序,它的工作原理。

VS日誌輸出:

Full log file: C:\Users\tester\AppData\Local\Temp\uitest\log-2016-08-03_10-57-46-734.txt 
Attempting IDE connection through pipe 0620e6c5f6094679bbb909f65a5f0702. 
Deploying app through IDE. 
Instructing the IDE to prepare the test app for execution. Session: Assembly=D:\Documents\Visual Studio 2015\Projects\MyTicketNativeApp\trunk\Cobeco.MyTicket.DroidApp.UITests\bin\Debug\Cobeco.MyTicket.DroidApp.UITests.DLL 
Platform=Android 
IDE integration failed to deploy app: There isn't any device or emulator available for running the application 
NUnit VS Adapter 2.0.0.0 executing tests is finished 
========== Run test finished: 11 run (0:00:02,6699974) ========== 

此外,完整日誌文件的輸出:

03-08-2016 10:57:46.749 +02:00 - 14 - Potential Android SDK location: (No path) - Not set. [ Source: ANDROID_HOME ] 
03-08-2016 10:57:46.750 +02:00 - 15 - Potential Android SDK location: D:\Android - Valid SDK. [ Source: Registry ] 
03-08-2016 10:57:46.750 +02:00 - 15 - Potential Android SDK location: D:\Android - Valid SDK. [ Source: Registry ] 
03-08-2016 10:57:46.750 +02:00 - 15 - Using Android SDK: D:\Android 
03-08-2016 10:57:46.750 +02:00 - 15 - Using JDK: C:\Program Files (x86)\Java\jdk1.7.0_55 [ Source: Registry ] 
03-08-2016 10:57:46.765 +02:00 - 30 - Attempting IDE connection for Android: D:\Documents\Visual Studio 2015\Projects\MyTicketNativeApp\trunk\Cobeco.MyTicket.DroidApp.UITests\bin\Debug\Cobeco.MyTicket.DroidApp.UITests.DLL. 
03-08-2016 10:57:46.765 +02:00 - 31 - Attempting IDE connection through pipe 0620e6c5f6094679bbb909f65a5f0702. 
03-08-2016 10:57:46.794 +02:00 - 59 - Deploying app through IDE. 
03-08-2016 10:57:46.794 +02:00 - 60 - Instructing the IDE to prepare the test app for execution. Session: Assembly=D:\Documents\Visual Studio 2015\Projects\MyTicketNativeApp\trunk\Cobeco.MyTicket.DroidApp.UITests\bin\Debug\Cobeco.MyTicket.DroidApp.UITests.DLL 
Platform=Android 
03-08-2016 10:57:46.807 +02:00 - 73 - IDE integration failed to deploy app: There isn't any device or emulator available for running the application 

回答

1

我終於明白了。必須在單元測試設置中手動將ip設置爲設備和apk文件的路徑。

例如爲:

AndroidApp app = ConfigureApp 
       .Android 
       .DeviceIp("127.0.0.1") //Localhost because i use an emulator 
       .ApkFile("<path-to-apk>") 
       .StartApp(); 
0

(對不起,無法評論還)您是否嘗試過重新打開模擬器或連接的物理設備?你使用哪個模擬器?目標平臺(armeabi,x86等)是否適用於您的仿真器設備?

+0

我試圖重新打開仿真器並重新啓動我的電腦多次。我沒有嘗試在物理設備上運行它,但項目必須在仿真器上運行。使用的模擬器是Xamarin Android Player和Google仿真器。 Hyper-V在我的機器上不起作用。目標平臺已改編。 – meik99

+0

什麼模擬器?哪些支持您的應用程序的體系結構? – Zhyano

+0

每個架構都被標記爲支持。 我的主要模擬器是一個Nexus 5與來自Xamarin Android Player的棒棒糖 – meik99

相關問題