I have a problem in a binding lib. project, using Xamarin 4.6 in VC 2017.
In an .aar project I have following code:
public static final class ConformImage {
public static final int DO_NOT_CONFORM_IMAGE = 0;
public static final int CONFORM_IMAGE = 1;
public ConformImage() {
}
}
Xamarin creats:
public sealed partial class ConformImage : global::Java.Lang.Object {
[Register ("CONFORM_IMAGE")]
public const int ConformImage = (int) 1;
...
The compiler is arguing that a Member is called like the class, "ConformImage". In my opinion xamarin renamed it wrong and created that problem.
Maybe anyone has an idea about that and could help me?
Thanks in advance.
答案 0 :(得分:0)
在Java名称的C#
规范化中,可能会发生名称冲突,可以通过Metadata.xml
绑定项目中Xamarin.Android
文件中的条目进行修复。
重命名该类或重命名const,您的选择:
<attr path="/api/package[@name='your.java.package.name.here']/class[@name='ConformImage']"
name="managedName">ConformImageEx</attr>
<attr path="/api/package[@name='your.java.package.name.here']/class[@name='ConformImage']/field[@name='DO_NOT_CONFORM_IMAGE']" name="managedName"> DoNotConformThisImage </attr>
<attr path="/api/package[@name='your.java.package.name.here']/class[@name='ConformImage']/field[@name='CONFORM_IMAGE']" name="managedName">ConformThisImage </attr>