sp958857 / Retrofit4Unity

Retrofit turns your HTTP API into a interface. Calling a request like calling a method.
27 stars 3 forks source link

Throws PlatformNotSupportedException on Android device #5

Open master9797 opened 5 years ago

master9797 commented 5 years ago

PlatformNotSupportedException: Operation is not supported on this platform. at Unity.ThrowStub.ThrowNotSupportedException () [0x00000] in <0000d56de0ae43ca875d7babfd990580>:0 at System.AppDomain.DefineDynamicAssembly (System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access) [0x00000] in <0000d56de0ae43ca875d7babfd990580>:0 at (wrapper remoting-invoke-with-check) System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName,System.Reflection.Emit.AssemblyBuilderAccess) at Castle.DynamicProxy.ModuleScope.CreateModule (System.Boolean signStrongName) [0x00080] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.ModuleScope.ObtainDynamicModuleWithWeakName () [0x00015] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.ModuleScope.ObtainDynamicModule (System.Boolean isStrongNamed) [0x0000a] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.ModuleScope.DefineType (System.Boolean inSignedModulePreferably, System.String name, System.Reflection.TypeAttributes flags) [0x00000] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.Generators.Emitters.ClassEmitter.CreateTypeBuilder (Castle.DynamicProxy.ModuleScope modulescope, System.String name, System.Type baseType, System.Collections.Generic.IEnumerable1[T] interfaces, System.Reflection.TypeAttributes flags, System.Boolean forceUnsigned) [0x00012] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor (Castle.DynamicProxy.ModuleScope modulescope, System.String name, System.Type baseType, System.Collections.Generic.IEnumerable1[T] interfaces, System.Reflection.TypeAttributes flags, System.Boolean forceUnsigned) [0x00000] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor (Castle.DynamicProxy.ModuleScope modulescope, System.String name, System.Type baseType, System.Collections.Generic.IEnumerable1[T] interfaces) [0x00010] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.Generators.BaseProxyGenerator.BuildClassEmitter (System.String typeName, System.Type parentType, System.Collections.Generic.IEnumerable1[T] interfaces) [0x0001e] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.Init (System.String typeName, Castle.DynamicProxy.Generators.Emitters.ClassEmitter& emitter, System.Type proxyTargetType, Castle.DynamicProxy.Generators.Emitters.SimpleAST.FieldReference& interceptorsField, System.Collections.Generic.IEnumerable1[T] interfaces) [0x0000c] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.Generators.InterfaceProxyWithoutTargetGenerator.GenerateType (System.String typeName, System.Type proxyTargetType, System.Type[] interfaces, Castle.DynamicProxy.Generators.INamingScope namingScope) [0x00061] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator+<>c__DisplayClass6_0.b__0 (System.String n, Castle.DynamicProxy.Generators.INamingScope s) [0x00000] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.Generators.BaseProxyGenerator.ObtainProxyType (Castle.DynamicProxy.Generators.CacheKey cacheKey, System.Func3[T1,T2,TResult] factory) [0x0011b] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.GenerateCode (System.Type proxyTargetType, System.Type[] interfaces, Castle.DynamicProxy.ProxyGenerationOptions options) [0x00085] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.DefaultProxyBuilder.CreateInterfaceProxyTypeWithoutTarget (System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) [0x00026] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyTypeWithoutTarget (System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) [0x00006] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget (System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options, Castle.DynamicProxy.IInterceptor[] interceptors) [0x00052] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget (System.Type interfaceToProxy, Castle.DynamicProxy.IInterceptor interceptor) [0x00000] in <6ff107b3e2404886abfc3b1c7cdfdaa1>:0 at Retrofit.RetrofitAdapter.Create[T] () [0x00034] in C:\Users\Computer\Documents\Trade Empires\Assets\Retrofit4Unity\Source\Retrofit\Retrofit\RetrofitAdapter.cs:95

My class public static IApi CreateApi() { if (api != null) return api; var adapter = new RetrofitAdapter.Builder() .SetEndpoint("http://192.168.1.108") .SetConverter(new DefalutConvert()).Build(); api = adapter.Create<IApi>(); return api; }