Firebase 如何将firestore集成到运行Win10 IOT Core的RaspberryPi UWP应用程序中?
我需要将Firebase的firestore功能添加到我的应用程序(背景UWP应用程序),该应用程序运行在运行Windows 10 IOT Core的raspberry(ARM)上 我设法使应用程序在我的PC上完全工作(其中包含firestore),并将其部署在raspberry上,但当应用程序启动时,我遇到一个错误:Firebase 如何将firestore集成到运行Win10 IOT Core的RaspberryPi UWP应用程序中?,firebase,google-cloud-firestore,raspberry-pi,arm,grpc,Firebase,Google Cloud Firestore,Raspberry Pi,Arm,Grpc,我需要将Firebase的firestore功能添加到我的应用程序(背景UWP应用程序),该应用程序运行在运行Windows 10 IOT Core的raspberry(ARM)上 我设法使应用程序在我的PC上完全工作(其中包含firestore),并将其部署在raspberry上,但当应用程序启动时,我遇到一个错误: Error: Value cannot be null. Parameter name: path1 at System.IO.Path.Combine(String,
Error: Value cannot be null. Parameter name: path1
at System.IO.Path.Combine(String, String) + 0x2c
at Grpc.Core.Internal.NativeExtension.LoadUnmanagedLibrary() + 0x36
at Grpc.Core.Internal.NativeExtension.LoadNativeMethods() + 0x28
at Grpc.Core.Internal.NativeExtension..ctor() + 0x12
at Grpc.Core.Internal.NativeExtension.Get() + 0x4a
at Grpc.Core.GrpcEnvironment.GrpcNativeInit() + 0x48
at Grpc.Core.GrpcEnvironment..ctor() + 0x64
at Grpc.Core.GrpcEnvironment.AddRef() + 0x54
at Grpc.Core.Channel..ctor(String, ChannelCredentials, IEnumerable`1) + 0xa8
at Google.Api.Gax.Grpc.GrpcCore.GrpcCoreAdapter.CreateChannelImpl(String, ChannelCredentials, GrpcChannelOptions) + 0x24
at Google.Api.Gax.Grpc.GrpcAdapter.CreateChannel(String, ChannelCredentials, GrpcChannelOptions) + 0x16
at Google.Api.Gax.Grpc.ChannelPool.GetChannel(GrpcAdapter, String, GrpcChannelOptions, ChannelCredentials) + 0x58
at Google.Api.Gax.Grpc.ChannelPool.GetChannel(GrpcAdapter, String, GrpcChannelOptions) + 0x1a8
at Google.Api.Gax.Grpc.ClientBuilderBase`1.CreateCallInvoker() + 0x5e
at Google.Cloud.Firestore.V1.FirestoreClientBuilder.BuildImpl() + 0x16
at Google.Cloud.Firestore.FirestoreDbBuilder.Build() + 0x1ee
at Google.Cloud.Firestore.FirestoreDb.Create(String, FirestoreClient) + 0x1bc
at Processing.Service.Firestore.<Initialize>d__22.MoveNext() + 0xc4
在这两种情况下,我都收到了224条警告,如:
ILTransform : warning ILT0028: Found native library 'W:\Service\obj\ARM\Release\ilc\in\grpc_csharp_ext.x64.dll' with unexpected CPU architecture 'amd64', while the current build target architecture is set to 'arm'. Your application may fail to launch. Please make sure to build your application with the matching CPU architecture. Service
ILTransform : warning ILT0028: Found native library 'W:\Service\obj\ARM\Release\ilc\in\grpc_csharp_ext.x86.dll' with unexpected CPU architecture 'x86', while the current build target architecture is set to 'arm'. Your application may fail to launch. Please make sure to build your application with the matching CPU architecture. Service
MCG : warning MCG0007: Unresolved P/Invoke method 'grpc_csharp_ext!gprsharp_convert_clock_type' for method 'Grpc.Core.Internal.Timespec Grpc.Core.Internal.NativeMethods.DllImportsFromSharedLib.gprsharp_convert_clock_type(Grpc.Core.Internal.Timespec, Grpc.Core.Internal.ClockType)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs. Service
MCG : warning MCG0007: Unresolved P/Invoke method 'grpc_csharp_ext!gprsharp_free' for method 'System.Void Grpc.Core.Internal.NativeMethods.DllImportsFromSharedLib.gprsharp_free(System.IntPtr)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs. Service
注:
- 设备上存在json配置文件和所需的环境变量
- 我使用“应用程序包”(*.appxbundle)在设备上部署
- 我使用的是Windows 10 IOT Core和UWP应用程序,因为这是我成功使应用程序在raspberry上工作的第一种方法,如果代码保持在C#,我愿意改变这一点
- 找到了一个教程()来为ARM重建“grpc_csharp_ext.x86”,但它给出了一个“.so”文件,而不是“.dll”
- 将“LibGrpc.Arm”和“LibGrpc_csharp_ext.arm7”添加到项目中
- 将“Google.Cloud.Firestore”nuget更新为“v2.3.0-beta1”
- 为ARM重建GRPC(它会生成dll文件吗?)
- 使用另一个Firestore nuget(即:Xamarin)代替Google.Cloud.Firestore
- 使用另一个Firebase SDK(即:Web或Unity)
- 在raspbian上运行此C#服务(如果可能),而不是Win 10 IOT Core(已尝试,相同错误…)
- 直接使用Firebase RPC API
谢谢问题是您试图在基于ARM的平台上使用Grpc.Core。Grpc.Core在内部依赖于一个本机库(Grpc_csharp_ext),而Grpc.Core包没有现成的该库的ARM构建版本,因此您所尝试的操作将不起作用 您可以做什么:
- 尝试使用grpc dotnet(grpc.Net.Client,),它没有本机组件,因此即使在基于ARM的raspberry上也可以正常工作
- 你可以试着自己编译grpc_csharp_ext来瞄准ARM,虽然这是完全可行的,但它相当复杂,所以我不建议这样做
ILTransform : warning ILT0028: Found native library 'W:\Service\obj\ARM\Release\ilc\in\grpc_csharp_ext.x64.dll' with unexpected CPU architecture 'amd64', while the current build target architecture is set to 'arm'. Your application may fail to launch. Please make sure to build your application with the matching CPU architecture. Service
ILTransform : warning ILT0028: Found native library 'W:\Service\obj\ARM\Release\ilc\in\grpc_csharp_ext.x86.dll' with unexpected CPU architecture 'x86', while the current build target architecture is set to 'arm'. Your application may fail to launch. Please make sure to build your application with the matching CPU architecture. Service
MCG : warning MCG0007: Unresolved P/Invoke method 'grpc_csharp_ext!gprsharp_convert_clock_type' for method 'Grpc.Core.Internal.Timespec Grpc.Core.Internal.NativeMethods.DllImportsFromSharedLib.gprsharp_convert_clock_type(Grpc.Core.Internal.Timespec, Grpc.Core.Internal.ClockType)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs. Service
MCG : warning MCG0007: Unresolved P/Invoke method 'grpc_csharp_ext!gprsharp_free' for method 'System.Void Grpc.Core.Internal.NativeMethods.DllImportsFromSharedLib.gprsharp_free(System.IntPtr)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs. Service