简体   繁体   中英

Xamarin.Forms Android Deploy

I am using Xamarin Forms and everything works fine in the emulator, but when I try to deploy to LivePLay I get errors like this.

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 

For these .dlls

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

So far I've tried pairing two devices and gotten the same results. App crashes on load if I try creating an apk and installing. Any idea what's going on and how to fix it?

The problem is, that live player isn't actually a "real" android (or iOS) environment. Similar to the Xamarin Previewer, that thing only works as long as you are doing "basic" stuff.

Once you start including Resources, use locally stored sql databases, write custom renderers, use dependency services and build views which rely on actual data, you are most likely to get dozens of exceptions.

The thing is: You can spend a lot of time and effort into making your code compatible with the live player environment or you just use an emulator or a real device for debugging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM