2015-12-24 57 views
1

我的xamarin应用程序在模拟器上运行,并且在我用PC连接时也在我的设备上运行。但是,当我创建它的apk,然后安装它在飞溅之后崩溃。我跟踪日志并尝试识别但失败。请帮我整理一下。日志低于提及:System.Reflection.TargetInvocationException:异常已被调用的目标抛出

10时44分37秒è单:未处理的异常:

10时44分37秒è单:System.Reflection.TargetInvocationException: 异常被抛出的目标一个调用。 ---> System.TypeLoadException:无法加载类型 System.Collections.Generic.KeyValuePair`2 [[System.String, System.Runtime,Version = 4.0.0.0,Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a], [System.String,System.Runtime, 版本= 4.0.0.0,文化=中性公钥= b03f5f7f11d50a3a]] [], mscorlib程序,版本= 2.0.5.0,文化=中性 公钥= 7cec85d7bea7798e而解码的自定义属性

10点44分37秒è单:在(包装托管到本机) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type的,布尔)

10时44分37秒Ê单:在System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider OBJ,System.Type的属性类型,布尔 inheritedOnly)[0x00019]在:0

10时44分37秒Ë单:在System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider OBJ,System.Type的属性类型,布尔 继承)[0x00040]在:0

10时44分37秒Ê单:在System.Reflection.MonoMethod.GetCustomAttributes (系统。类型attributeType,布尔继承)[0x00000] in:0

10时44分37秒è单:在 System.ServiceModel.Description.ContractDescriptionGenerator.GetOrCreateOperation (System.ServiceModel.Description.ContractDescription CD, System.Reflection.MethodInfo英里,System.Reflection.MethodInfo serviceMethod,系统.ServiceModel.OperationContractAttribute酢浆草, System.Reflection.MethodInfo endMethod,布尔isCallback, 的System.Type givenServiceType)[0x0022d]在:0

10点44分37秒Ê单:在 System.ServiceModel.Description.ContractDescriptionGenerator .FillOperationsForInterface (System.ServiceModel.Description.ContractDes cription CD,System.Type的 exactContractType,System.Type的givenServiceType,布尔isCallback) [0x00134]在:0

十点44分37秒Ê单:在 System.ServiceModel.Description.ContractDescriptionGenerator.GetContractInternal (系统.TYPE givenContractType,System.Type的givenServiceType, 的System.Type serviceTypeForCallback)[0x002d4]在:0

10时44分37秒Ê单:在 System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type的givenContractType ,System.Type givenServiceType, 系统。型serviceTypeForCallback)[0x00000]在:0

10时44分37秒Ê单:在 System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type的givenContractType,System.Type的givenServiceType) [0x00000]中: 0

10时44分37秒Ê单:在 System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type的合约类型)[0x00000]在:0

10时44分37秒Ê单:在 System.ServiceModel.Description.ContractDescription.GetContract (System.Type的合约类型)[0x00017]在:0

10时44分37秒Ê单:在 System.ServiceModel.ChannelFactory`1 [TChannel] .CreateDescription() [0x00000]在:0

10点44分37秒Ê单:在 System.ServiceModel.ChannelFactory`1 [TChannel] ..构造函数(的System.Type 型)[0x00033]在:0

10点44分37秒Ë单: at System.ServiceModel.ChannelFactory`1 [TChannel] .. ctor (System.ServiceModel.Channels.Binding binding, Sys tem.ServiceModel.EndpointAddress remoteAddress)[0x00000]在 :0

10时44分37秒Ê单:在 System.ServiceModel.ClientBase`1 [TChannel] .Initialize (System.ServiceModel.InstanceContext例如, System.ServiceModel.Channels.Binding结合, System.ServiceModel.EndpointAddress remoteAddress)[0x00000]在 :0

10时44分37秒Ê单:在System.ServiceModel.ClientBase`1 [TChannel] ..构造函数 (System.ServiceModel.InstanceContext实例, System.ServiceModel.Channels.Binding绑定, 系统.ServiceModel.EndpointAddress remoteAddress)[0x0003f]在 :0

10点44分37秒Ê单:在System.ServiceModel.ClientBase`1 [TChannel] ..构造函数 (System.ServiceModel.Channels.Binding结合, System.ServiceModel.EndpointAddress remoteAddress)[0x00000]在 :0

10时44分37秒Ê单:在AceVqbzServiceClient..ctor (System.ServiceModel.Channels.Binding结合, System.ServiceModel.EndpointAddress remoteAddress )[0x00000] :0

10: 44:37Ë单:在(包装管理到本机) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,对象,对象[],System.Exception的&)

10时44: 37 E mono:在System.Refle

+0

您需要添加参考system.runtime版本4.0.0.0它不能加载它 – loneshark99

+0

在我的视觉工作室,它显示它已被添加。即使当我删除这些引用我的项目仍然在模拟器中运行,并没有给出任何错误 –

+0

你需要启用融合日志,它会给你更多的信息,哪些程序集没有得到加载。还检查bin文件夹什么是所有程序集 – loneshark99

回答

0

您是否在链接程序集? Xamarin包含链接程序集以减小APK大小的功能,但并非所有程序集似乎都允许。

要确认,我会将调试设置更改为与发行版相同或禁用发行版的链接。(Build> Droid Project Options)

+0

是的,我知道了。我试图设置链接没有但仍然得到相同的错误。 –

+0

@AjaySharma我建议你将你的问题重命名为“System.TypeLoadException:无法加载类型System.Collections.Generic.KeyValuePair”,因为这是你的异常,也试图在这些情况下使用堆栈跟踪支付 – Niklas

+0

@Virgil什么“堆栈跟踪”可以做些什么? –

1

应用程序崩溃是因为在链接程序集时删除了一些代码。因此,您需要确定该代码或删除,如果您可以通过其他方式选择其他方式,则可以根据您的错误日志自定义您的链接器

要运行我的apk,我跳过/排除三个DLL的链接时创建apk。即System.Collection,System.Runtime,System.Runtime.Serialization。做你的Droid相同的项目只需右击选择属性,选择Android的选项选项卡,你在下面的图像所见: enter image description here

相关问题