Xamarin.Forms Android部署

时间:2018-09-11 01:04:17

标签: android xamarin.forms

我正在使用Xamarin Forms,并且在模拟器中一切正常,但是当我尝试将其部署到LivePLay时,会出现这样的错误。

Error       Failed to load assembly from stream: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path "/data/user/0/com.xamarin.live/files/.nuget/packages/system.security.principal.windows/4.4.0/ref/netstandard2.0/System.Security.Principal.Windows.dll".
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at System.IO.File.OpenRead (System.String path) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
at <StartupCode$Continuous-Core-Droid>.$LocalFileSystem+Upsight-IFileSystem-OpenReadAsync@49-1.Invoke () [0x00011] in <5b4cad9611b47c3aa745038396ad4c5b>:0 
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
at System.Threading.Tasks.Task.Execute () [0x00010] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 

对于这些.dll

System.Security.Principal.Windows.dll
System.Security.AccessControl.dll
SQLitePCLRaw.provider.e_sqlite3.dll
SQLitePCLRaw.lib.e_sqlite3.dll
Microsoft.Win32.Registry.dll

到目前为止,我已经尝试将两个设备配对并获得相同的结果。如果我尝试创建apk并安装,则应用程序在加载时崩溃。知道发生了什么以及如何解决吗?

1 个答案:

答案 0 :(得分:1)

问题是,实时播放器实际上不是真正的android(或iOS)环境。与Xamarin Previewer相似,只有在您执行“基本”操作时,该功能才起作用。

一旦开始包括参考资料,使用本地存储的sql数据库,编写自定义渲染器,使用依赖项服务以及构建依赖于实际数据的视图,您很可能会遇到数十种异常。

问题是:您可以花费大量时间和精力使代码与实时播放器环境兼容,或者仅使用仿真器或真实设备进行调试。