微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Compliation Error虽然在android中为单声道引用iTextSharp Dll

在引用iTextSharp dll时出现以下错误

C:\Program Files\MSBuild\Novell\Novell.MonoDroid.Common.targets(2,2):
Error: Exception while loading assemblies:
System.IO.FileNotFoundException: Could not load assembly
‘System.Drawing,Version=2.0.0.0,Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a’. Perhaps it doesn’t exist in the Mono
for Android profile?

File name: ‘System.Drawing.dll’

at Monodroid.Tuner.MonoDroidResolver.Resolve(AssemblyNameReference
reference,ReaderParameters parameters)

at
Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1
assemblies,AssemblyDeFinition assembly)

at Xamarin.Android.Tasks.ResolveAssemblies.Execute() (Dashmate)

另外我试图添加System.Drawing.dll,但它仍然没有解决
错误.

猜猜Mono.Android.dll中的System.Drawing与之相矛盾
iTextSharp引用的System.Drawing.dll

最佳答案
错误告诉您(托管)链接器无法加载程序集.需要此程序集来满足您链接代码所需的一些引用.没有它,链接器就无法重写较小的有效(即工作)程序集.

在这种情况下,它看起来像针对桌面框架程序集编译的iTextSharp(即2.0.0.0版本是提示,Android版本的Mono将是2.1.x).

通常,此类问题的解决方案是针对Mono for Android提供的程序集重新编译项目(在本例中为iTextSharp).这样所有引用都将针对M4A程序集,并且链接器将能够处理它们(因为它们不会丢失任何内容,否则它将在编译时失败).

请注意,如果它依赖于System.Drawing.dll中的太多内容,则可能无法从源代码重新编译iTextSharp.

Also I tried to add System.Drawing.dll,but it still did not resolve the error.

使用桌面装配不太可行(因为它们依赖于不同的装配,具有不同的类型……).

此外,Windows(或Mono)附带的System.Drawing.dll无法与Mono for Android一起使用,因为它们依赖于不属于Android的GDI(或libgdiplus for Mono).

Guess the System.Drawing within the Mono.Android.dll is conflicting with the System.Drawing.dll which is being referenced by the iTextSharp

没有程序集冲突,因为Android的Mono没有附带System.Drawing.dll程序集.但是包含一些类型(例如Rectangle [F],Point [F]和Size [F])(在另一个程序集中)使用System.Drawing.*命名空间,因为它们对.NET开发人员有用(并且是众所周知的).

原文地址:https://www.jb51.cc/android/430662.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐