在类型 'RequiresPermission' 中找不到注释方法 'anyOf()':

Cannot find annotation method 'anyOf()' in type 'RequiresPermission':

我正在尝试将 Android Studio 中的 Android 应用移植到 Visual Studio 2015 / Xamarin.我尝试 运行 项目,我得到:

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

Additionally, check Build->Configuration Manager to ensure this project is set to Deploy for this configuration.

我在主 class 中添加了 [Activity(MainLauncher = true)] 并检查了 Build->Configuration 似乎是正确的,但这些都没有效果。

我收到此警告:

Cannot find annotation method 'anyOf()' in type 'RequiresPermission': 
class file for android.support.annotation.RequiresPermission not found  
MyApplication.Native.Droid  C:\Users\allelopath\AppData\Local\Xamarin\GooglePlayServices.Maps.4.0\embedded\classes.jar(com/google/android/gms/maps/GoogleMap.class)   

我也收到这个警告:

Warning     
Found conflicts between different versions of the same dependent assembly. 
In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; 
otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding> 
Acquaint.Native.Droid           

我按照提示双击,它会问:

Do you want to fix these conflicts by adding binding redirrect records in the application configuration file?

我点击是。这最终没有效果,重建并尝试运行后,警告再次出现。

我卸载了设备上的应用程序,该应用程序是从 运行 在 Android Studio 上安装的,但这也没有任何效果。

你有什么建议?

对于第一个问题,我会右键单击您的解决方案,转到“配置属性”并确保正在构建所有正确的项目,并选中您的 android 项目的“部署”框。这只是一个糟糕的 Xamarin 倾向。

我自己有第二个警告,这只是因为 Android 支持库要求您针对 sdk 版本 23 进行编译。Google 地图包必须使用这些新注释。我没有因为这个错误遇到任何问题,minSdkVersion 为 15,所以我只能忍受它。

我也有相同的依赖程序集警告,我认为正在发生的事情是我有一个项目正在使用比 .net http 使用的任何内容更新的 .net 基元引用。只是一个猜测,但我也不担心让它开心。