这里是出了apk之后,实际运行时报的错误。
开始的时候想法是Newtonsoft是不是安卓不兼容
然后试下用Unity的Json。他虽然兼容性好,但是功能不强大。
然后觉得这个东西使用人数都以亿计算了,之前自己在安卓和苹果用的好好地,怎么还会出现这种情况。可能是版本不对。然后随意瞎换版本。
后来试了几次不行,就百度了关键字
Newtonsoft.Json:PlatformNotSupportedException: Operation is not supported on this platform.
发现是json的c#版本和项目的c#版本对不上。 【Newtonsoft.Json】踩坑记录
PlatformNotSupportedException: Operation is not supported on this platform
at Unity.ThrowStub.ThrowNotSupportedException () [0x00000] in <44afb4564e9347cf99a1865351ea8f4a>:0
at System.Reflection.Emit.DynamicMethod..ctor (System.String name, System.Type returnType, System.Type[] parameterTypes, System.Type owner, System.Boolean skipVisibility) [0x00000] in <44afb4564e9347cf99a1865351ea8f4a>:0
at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDynamicMethod (System.String name, System.Type returnType, System.Type[] parameterTypes, System.Type owner) [0x00019] in <3006a826db994760a0637253dbc4cdb8>:0
at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDefaultConstructor[T] (System.Type type) [0x00010] in <3006a826db994760a0637253dbc4cdb8>:0
at Newtonsoft.Json.Serialization.DefaultContractResolver.GetDefaultCreator (System.Type createdType) [0x00005] in <3006a826db994760a0637253dbc4cdb8>:0
at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContrac
这个网址有比较全的NewTonSoft.json。使用对应版本就好。