Tag: xamarin.android

单声道C#十进制分割的精度是不同的?

decimal d1 = 4.0m; decimal d2 = 40.0m; decimal d = d1 / d2; string repr = d.ToString(); 在Windows上,我为repr获得“0.1”。 在Mono(Xamarin Android)上,我获得了“0.1000000000000000000000000000”左右。 是什么赋予了? 此外,我已经看到建议除以1.0000000000000000000000000000m以摆脱不必要的尾随零。 这在Xamarin Android上都不起作用。 已知错误? 或者技术上不是错误 – 这是否符合标准? 为了摆脱零,我将值转换为字符串,从字符串中删除尾随零,并将其转换回小数。 它很弱。 此外,我的解决方案不会产生我想要的确切结果。 我宁愿留下相当重要的尾随零,而不是删除所有尾随零。

Xamarin.Auth:更新应用时,帐户数据不会保留

我正在使用Xamarin.Auth对foursquare等服务进行身份validation。 我的身份validation代码运行良好,问题是当我部署新版本的应用程序时,帐户数据不会保留 – 每次我在手机上部署测试版本时,我都要重新进行身份validation。 这是我存储帐户的方式; /// /// Stores the account. /// private void StoreAccount(AuthenticatorCompletedEventArgs eventArgs) { if (!eventArgs.IsAuthenticated) // make sure we are authenticated. { Log.Debug(Logging.AppTag, “FourSquareClient can’t store account as auth. is cancelled. “); return; } this.IsAuthenticated = true; this.Account = eventArgs.Account; AccountStore.Create(this.OwnerContext).Save(eventArgs.Account, “Foursquare”); } 这是我如何检查我们是否有一个存储帐户; /// /// Retrieves stored account. /// private void […]

System.IO.FileNotFoundException:无法在Mono for Android中加载程序集System.Web

我正在使用Xamarin构建一个使用SkyDrive .Net API客户端的Android应用程序,但是当我在模拟器上运行我的Android应用程序时遇到以下错误 Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly ‘System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. Perhaps it doesn’t exist in the Mono for Android profile? File name: ‘System.Web.dll’ at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00000] in :0 at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in :0 at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (System.Collections.Generic.List`1 assemblies, Mono.Cecil.AssemblyDefinition assembly, Boolean topLevel) [0x00000] […]

从服务器xamarin.android收到的证书无效

所以这让我疯狂了一天。 我正在尝试与xamarin.android上的REST API交谈但由于某种原因我收到此错误: InnerException {Mono.Security.Protocol.Tls.TlsException:从服务器收到的证书无效。 错误代码:0xoffffffff.Handshake.Client.TlsServerCertificate.RemoteValidation(Mono.Security.Protocol.Tls.ClientContext上下文,AlertDescription描述)[0x00000]中的错误代码:0xffffffff800b010a:0:Mono.Security.Protocol.Tls。 Handshake.Client.TlsServerCertificate.validateCertificates(Mono.Security.X509.X509CertificateCollection证书)[0x00000] in:0 at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1()[0x00000] in:0 at Mono。 Security.Protocol.Tls.Handshake.HandshakeMessage.Process()[0x00000] in:0 at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage(Mono.Security.Protocol.Tls.TlsStream handMsg)[0x00000] in:0 at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback(IAsyncResult asyncResult)[0x00000] in:0} Mono.Security.Protocol.Tls.TlsException 经过一些研究后,我发现这与我正在谈论的服务器丢失的证书有关(如果我错了,请纠正我)。 所以我将SSL证书添加到Mac上的钥匙串中。 我还运行了Mozilla命令来安装默认证书。 不幸的是,这仍然无效。 在Windows上,与API的连接就像魅力一样。 从我读到的这是因为Windows有自己的CA商店和一些默认证书。

无法找到Android支持库和媒体路由器.jar文件

我对Xamarin来说是全新的。 我想将地图添加到Xamarin.Android中的默认hello世界。 我已经从指南中逐步准备好了Manifest。 还通过sdk manager下载了支持库,但是我收到错误,要求我安装SL和SL媒体路由器。 这里的清单: 我得到的一些错误: /Users/apple/Projects/MyAppNameAndroid/MyAppNameAndroid: Error XA5207: Please install package: ‘Android Support Library’ available in SDK installer. Java library file /Users/apple/.local/share/Xamarin/Android.Support.v7.AppCompat/21.0.3/embedded/classes.jar doesn’t exist. (XA5207) (MyAppNameAndroid) /Users/apple/Projects/MyAppNameAndroid/MyAppNameAndroid: Error XA5209: Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r10.zip and extract it to the /Users/apple/.local/share/Xamarin/Android.Support.v7.AppCompat/21.0.3/content directory. (XA5209) (MyAppNameAndroid) /Users/apple/Projects/MyAppNameAndroid/MyAppNameAndroid: Error XA5209: Reason: /Users/apple/.local/share/Xamarin/Android.Support.v7.AppCompat/21.0.3/android_m2repository_r10.zip is not a valid zip […]

二进制XML文件行#1:错误膨胀类android.support.design.widget.AppBarLayout

大家好 在这种情况下有许multithreading可用…我尝试了一切,但没有运气。 我是android背景的新手。我是c#家伙,现在iam与xamarin droid一起工作……所以任何人都可以解释什么是错误。这个解决方案不起作用** PRE lolipop devices **。 我的布局 我是使用appcompact主题 值/ Style.xml @drawable/splashscreen true false false true @color/DarkOrangeLight @color/DarkOrange @color/DarkOrangeAcent true @color/bg false false true 值-21 \ styles.xml true @color/DarkOrange 我的主要活动 protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); try { SetContentView(Resource.Layout.MansoryLayout); } catch(Exception ex) { Console.WriteLine(ex.Message); } } 我在setcontentview方法上遇到错误一次调用…. 详细例外情况: {Android.Views.InflateException: Exception of type ‘Android.Views.InflateException’ […]

Monodroid:执行完整的GC

我尝试创建我的小粒子系统。 我有粒子列表的粒子管理器,并在canvas上绘制我的粒子。 我只是在init()函数中创建了一些像Paint等新对象! 如果粒度<0,我将其删除: for (int particle = 0; particle 0 ? true : false { particles[particle] = null; //here I tried all variations like //((IDisposable)particles[particle]).Dispose(); //GC.SuppressFinalize(particles[particle]); //System.GC.ReRegisterForFinalize(particles[particle]); //((Java.Lang.Object)particles[particle]).Dispose(); and etc particles.Remove(particles[particle]); } 然后我创建新的粒子并将其添加到我的列表中。 我在日志中看到的内容: GC cleanup summary: 1063 objects tested – resurrecting 1002. GC cleanup summary: 1053 objects tested – resurrecting 992. … GC […]

CS0117 C#’Resource.Id’不包含“PhoneNumberText”的定义

我使用Visual Studio 2015和Xamarin。 我正在命名我的项目“Phoneword”我在Xamarin的网站上看到了这个代码,例如tutorial / example。 TranslateButton和CallButton成员的错误相同。 MainActivity.cs using System; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; namespace Phoneword { [Activity(Label = “Phoneword”, MainLauncher = true)] public class MainActivity : Activity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the “main” layout resource SetContentView(Resource.Layout.Main); // […]

SingamaR在Xamarin.Forms

我正在尝试为SignalR创建一个Xamarin.Forms PCL客户端。 我发现每个教程都是如何将SignalR添加到Xamarin.Android或Xamarin.iOS。 如何将SignalR添加到Xamarin.Forms项目? 我应该创建一个单独的PCL,称之为“代理”,然后在Xamarin.iOS,Android和Windows Mobile项目中使用此PCL吗? 如果1),我是否应该在每个项目中添加SignalR(除了PCL,我真的在使用它)? 我应该在创建Xamarin.Forms解决方案时添加默认创建的PCL吗? 感谢帮助, 这是我得到的问题:我有一个完全工作的Xamarin.Forms PCL项目。 我删除了所有窗口的东西。 我刚离开PCL,iOS和Android项目。 有用! 我只添加了CocosSharp,但不使用它。 平原,空虚,从未接触过Xamarin.Forms。 然后我将SingalR添加到PCL项目中。 顺便说一句,跑步! 但是当我添加JUST这一行时: var connection = new HubConnection(“http://localhost:52128”); 它甚至没有编译。 我收到错误: 加载程序集时出现exception:System.IO.FileNotFoundException:无法加载程序集’Newtonsoft.Json,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’。 也许它在Mono for Android配置文件中不存在 我完全迷失了。 我试过了: 在PCL上安装nuget – 错误 在每个项目上安装 – 错误 创建新PCL,在那里实现该行,将其添加为主PCL的引用。 从第二个PCL调用方法 – 错误。

GetAllNetworkInterfaces()抛出exception

在Mono for Android中,我试图在本地网络中获取设备的所有IP地址。 我不介意环回,但我对调用DNS不感兴趣。 最好的方式似乎是打电话…… using System.Net.NetworkInformation; NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces(); …除了它抛出…… System.EntryPointNotFoundException:getifaddrs 有什么建议?