• Newtonsoft.Json 在安卓上报错


    Markdown
    System.PlatformNotSupportedException: Operation is not supported on this platform.at System.Reflection.Emit.DynamicMethod…ctor (System.String name, System.Type returnType, System.Type]] parameterTypes, System.Type owner,System.Boolean skipVisibility) [Ox00000] in <00000000000000000000000000000000>:0
    at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDynamicMethod (System.String name, System.Type returnType, System.Type]lparameterTypes, System.Type owner) [0x00000] in <00000000000000000000000000000000>:0
    at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDefaultConstructor[T] (System.Type type) [Ox00000] in<0000000000000000000>:0
    at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract (Newtonsoft.Json.Serialization.JsonContract contract) [Oxo0000] in
    007:0
    at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract (System.Type objectType) [Ox00000] in
    at Newtonsoft.Json.Utilities.ThreadSafeStore 2[TKey,TValue].AddValue (TKey key) [Ox00000] in <0000000000000
    000>:0
    at Newtonsoft.Json.Utilities.ThreadSafeStore 2[TKey,TValue].Get (TKey key) [Ox00000] in <00000000
    0>:0
    at Newtonsoft.Json.Serialization.JsonSerializerinternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.TypelobjectType) [0x00000] in <0000000000000>:0at Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [Ox00000] in
    n:0
    at Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer)[Ox00000] in <0000000000>:

    unity上使用 Newtonsoft.Json 序列化不报错,打安卓包运行就报这个错

    解决办法:
    在这里插入图片描述

    设置中修改 Api Compatibility Level

    使用官方的 json 库,不要用 Newtonsoft.Json.dll,通过 Package Manager 安装 com.unity.nuget.newtonsoft-json

  • 相关阅读:
    python django 小程序点餐源码
    使用Ascend八卡训练报错,len to make them match
    RabbitMQ(七)高级发布确认与优先级队列
    XML外部实体漏洞 (XXE)简介
    公钥私钥传输,以及对CA证书的理解
    sklearn.preprocessing.StandardScaler¶
    基于等级保护梳理服务器安全合规基线
    vi 连线板.
    一文详细理解计算机网络体系结构(考试和面试必备)
    【赠书活动】如何提高C++代码的性能
  • 原文地址:https://blog.csdn.net/sinat_34014668/article/details/139648054