Newtonsoft.Json:PlatformNotSupportedException: Operation is not supported on this platform.

本文记录了解决Newtonsoft.Json在Unity项目中遇到的PlatformNotSupportedException的过程。问题源于Newtonsoft.Json版本与项目使用的C#版本不匹配。通过调整版本,最终解决了跨平台的兼容性难题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这里是出了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。使用对应版本就好。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

染指流年丨

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值