我认为这是人们多年来一直处理的一个问题,应该解决折旧的版本,但我在这里。我花了更多的时间来承认似乎是一个简单的问题。
这是我的包文件夹
<packages>
<package id="Com.Airbnb.Xamarin.Forms.Lottie" version="1.0.0.7" targetFramework="portable45-net45+win8+wp8" />
<package id="HockeySDK.Xamarin" version="4.1.4" targetFramework="portable45-net45+win8+wp8" />
<package id="Microsoft.Azure.Mobile.Client" version="3.1.0" targetFramework="portable45-net45+win8+wp8" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="portable45-net45+win8+wp8" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="portable45-net45+win8+wp8" />
<package id="Microsoft.Data.Edm" version="5.8.2" targetFramework="portable45-net45+win8+wp8" />
<package id="Microsoft.Data.OData" version="5.8.2" targetFramework="portable45-net45+win8+wp8" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable45-net45+win8+wp8" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable45-net45+win8+wp8" />
<package id="System.Spatial" version="5.8.2" targetFramework="portable45-net45+win8+wp8" />
<package id="UXDivers.Artina.Shared" version="2.0.52" targetFramework="portable45-net45+win8+wp8" />
<package id="UXDivers.Artina.Shared.Base" version="2.0.52" targetFramework="portable45-net45+win8+wp8" />
<package id="UXDivers.Effects" version="0.6.0" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarintvos10+xamarinwatchos10+xamarinios10" />
<package id="Xam.Plugin.Connectivity" version="2.3.0" targetFramework="portable45-net45+win8+wp8" />
<package id="Xamarin.FFImageLoading" version="2.2.9" targetFramework="portable45-net45+win8+wp8" />
<package id="Xamarin.FFImageLoading.Forms" version="2.2.9" targetFramework="portable45-net45+win8+wp8" />
<package id="Xamarin.FFImageLoading.Transformations" version="2.2.9" targetFramework="portable45-net45+win8+wp8" />
<package id="Xamarin.Forms" version="2.3.4.247" targetFramework="portable45-net45+win8+wp8" />
</packages>
这是我的Droid MainActivity类
public class MainActivity : FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
// Changing to App's theme since we are OnCreate and we are ready to
// "hide" the splash
base.Window.RequestFeature(WindowFeatures.ActionBar);
base.SetTheme(Resource.Style.AppTheme);
FormsAppCompatActivity.ToolbarResource = Resource.Layout.Toolbar;
FormsAppCompatActivity.TabLayoutResource = Resource.Layout.Tabs;
base.OnCreate(bundle);
// Initialize Azure Mobile Apps
CurrentPlatform.Init();
...
}
}
在我的Cloud Service中我有这个
public AzureCloudService()
{
client = new MobileServiceClient("https://For-me-to-know.com");
}
关于新MobileServceClient的实例化,我得到了这个错误
system.InvalidOperationException:找不到当前平台的Microsoft Azure移动服务程序集。确保当前项目引用Microsoft.WindowsAzure.Mobile和以下特定于平台的程序集:Microsoft.WindowsAzure.Mobile.Ext。
修改 @Bruce是的,我的droid和iOs项目已经添加了移动客户端
我还运行了断点,它在尝试实现上述移动客户端之前首先执行主要活动。
答案 0 :(得分:1)
根据您的packages.config
,这似乎来自您的PCL项目。
因此,如果您在Droid项目下初始化MobileServiceClient
,则需要确保已为Droid项目安装了Azure Mobile Client SDK NuGet包,如下所示:
此外,我注意到您在Droid MainActivity类中添加了CurrentPlatform.Init();
。我建议您在启动CurrentPlatform.Init()
实例之前检查MobileServiceClient
调用是否正确。