【发布时间】:2016-03-30 19:18:53
【问题描述】:
我的 xamarin 应用程序在模拟器上运行,并且当我连接到我的 PC 时也在我的设备上运行。但是,当我创建它的 apk 然后在启动画面后安装它时崩溃。我跟踪日志并尝试识别但失败了。请帮我整理一下。日志如下:
10:44:37 E 单声道:未处理的异常:
10:44:37 E 单声道:System.Reflection.TargetInvocationException: 调用的目标已引发异常。 ---> System.TypeLoadException:无法加载类型 System.Collections.Generic.KeyValuePair`2[[System.String, System.Runtime,版本=4.0.0.0,文化=中性, PublicKeyToken=b03f5f7f11d50a3a],[System.String, System.Runtime, 版本=4.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a]][], mscorlib,版本=2.0.5.0,文化=中性, PublicKeyToken=7cec85d7bea7798e 解码自定义属性时
10:44:37 E mono : at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)
10:44:37 E 单声道:在 System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType, Boolean hiddenOnly) [0x00019] in :0
10:44:37 E 单声道:在 System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean 继承)[0x00040] in :0
10:44:37 E 单声道:在 System.Reflection.MonoMethod.GetCustomAttributes (System.Type attributeType, Boolean 继承) [0x00000] in :0
10:44:37 E 单声道:在 System.ServiceModel.Description.ContractDescriptionGenerator.GetOrCreateOperation (System.ServiceModel.Description.ContractDescription 光盘, System.Reflection.MethodInfo mi, System.Reflection.MethodInfo serviceMethod, System.ServiceModel.OperationContractAttribute oca, System.Reflection.MethodInfo endMethod, Boolean isCallback, System.Type givenServiceType) [0x0022d] in :0
10:44:37 E 单声道:在 System.ServiceModel.Description.ContractDescriptionGenerator.FillOperationsForInterface (System.ServiceModel.Description.ContractDescription 光盘,System.Type exactContractType, System.Type givenServiceType, Boolean isCallback) [0x00134] 在:0
10:44:37 E 单声道:在 System.ServiceModel.Description.ContractDescriptionGenerator.GetContractInternal (System.Type givenContractType, System.Type givenServiceType, System.Type serviceTypeForCallback) [0x002d4] in :0
10:44:37 E 单声道:在 System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type givenContractType, System.Type givenServiceType, System.Type serviceTypeForCallback) [0x00000] in :0
10:44:37 E 单声道:在 System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type givenContractType, System.Type givenServiceType) [0x00000] 在 :0
10:44:37 E 单声道:在 System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type contractType) [0x00000] in :0
10:44:37 E 单声道:在 System.ServiceModel.Description.ContractDescription.GetContract (System.Type contractType) [0x00017] in :0
10:44:37 E 单声道:在 System.ServiceModel.ChannelFactory`1[TChannel].CreateDescription() [0x00000] 在 :0
10:44:37 E 单声道:在 System.ServiceModel.ChannelFactory`1[TChannel]..ctor (System.Type 类型)[0x00033] in :0
10:44:37 E 单声道:在 System.ServiceModel.ChannelFactory`1[TChannel]..ctor (System.ServiceModel.Channels.Binding 绑定, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] 在 :0
10:44:37 E 单声道:在 System.ServiceModel.ClientBase`1[TChannel].Initialize (System.ServiceModel.InstanceContext 实例, System.ServiceModel.Channels.Binding 绑定, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] 在 :0
10:44:37 E 单声道:在 System.ServiceModel.ClientBase`1[TChannel]..ctor (System.ServiceModel.InstanceContext 实例, System.ServiceModel.Channels.Binding 绑定, System.ServiceModel.EndpointAddress remoteAddress) [0x0003f] 在 :0
10:44:37 E 单声道:在 System.ServiceModel.ClientBase`1[TChannel]..ctor (System.ServiceModel.Channels.Binding 绑定, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] 在 :0
10:44:37 E 单声道:在 AceVqbzServiceClient..ctor (System.ServiceModel.Channels.Binding 绑定, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] 在 :0
10:44:37 E mono : at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
10:44:37 E 单声道:在 System.Refle
【问题讨论】:
-
您需要添加对 system.runtime 版本 4.0.0.0 的引用它无法加载它
-
在我的视觉工作室中,它显示它已经被添加。即使我删除了这些引用,我的项目仍然在模拟器中运行并且没有给出任何错误
-
您需要启用融合日志,它将为您提供有关未加载哪个程序集的更多信息。还要检查 bin 文件夹中的所有程序集都有哪些
-
不,但是 System.Runtime.Serialization.dll 在这里显示为红色
-
请启用融合日志这是一个非常简单的问题
标签: c# visual-studio-2013 xamarin xamarin.android apk