[SetUp] public void Setup() { app = ConfigureApp.Android.AppBundle("/path/to/application.apk").StartApp(); }
以前我习惯用右键单击我的项目并按“发布.apk文件”,这将创建一个文件供我使用.这里讨论了类似的技术:http://www.sweet-web-design.com/wordpress/how-to-build-your-android-app-for-testing-in-visual-studio/2581/
但是现在Xamarin引入了一个名为“Archiving”的东西,这里有人谈到:https://developer.xamarin.com/releases/vs/xamarin.vs_4/xamarin.vs_4.2/#publishing
哪个州:
The new Archive command replaces the old Build > Export Android
Package (.apk) and Tools > Android > Publish Android App commands.
归档按钮给我一个错误,我实际上无法读取(无论我有多大的窗口),请参阅下面的内容:
那么我有没有办法使用visual studio创建一个.apk文件,最好没有“Archive”功能(因为在开发ui测试时创建一个单独的包版本似乎是浪费时间,加上实际上并不起作用)
解决方法
来自Xamarin文档:
The next step is to establish the association between the UITest project and the mobile apps. Right click on the References folder in the UITest project and select Add References… from the context menu. Select the mobile app projects from the Reference Manager dialog that appears.
完成此操作后,您无需在UITest中指定应用程序包的路径. .apk路径应该由Xamarin.UITest确定,因为引用了项目.