• 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

  • 相关阅读:
    斯坦福NLP课程 | 第12讲 - NLP子词模型
    基于51单片机万年历设计—显示温度农历
    盘点python与其他编程语言12条区别
    从零开始的力扣刷题记录-第八十九天
    Java面试题(24)-单例模式的几种写法
    java面试常问
    Windows资源管理器已停止工作的解决方法
    〖Python 数据库开发实战 - MySQL篇⑪〗- 修改数据表结构
    Python删除GCS文件夹的问题
    第七章 操作位和位串(三)
  • 原文地址:https://blog.csdn.net/sinat_34014668/article/details/139648054