Need help with Java Bindings (nested classes are generated!)

I created a java binding and I'm getting the following error

Error   50  'C001': member names cannot be the same as their enclosing type 

Upon checking the generated file, I found there was a nested class with the same name as the containing class!?!

// Metadata.xml XPath class reference: path="/api/package[@name='']/class[@name='c001']"
[global::Android.Runtime.Register ("it/custom/printer/api/android/p001/c001", DoNotGenerateAcw=true)]
public partial class C001 : global::Java.Lang.Object {

    // Metadata.xml XPath class reference: path="/api/package[@name='']/class[@name='c001.c001']"
    [global::Android.Runtime.Register ("it/custom/printer/api/android/p001/c001$c001", DoNotGenerateAcw=true)]
    public partial class C001 : global::Java.Lang.Object {

I tried renaming the class (in metadata.xml) but this is causing a bunch of other errors. I am not sure if renaming the nested class is the right way of fixing this issue.

Can anybody help me with the java binding for the attached jar file?


  • SpartanSpartan USMember

    Anybody care to help on this?

  • moljacmoljac HRBeta ✭✭✭


    Why renaming? The important part is to determine cause of error. I have never had case where I needed to change the name of the class. This would need (when you teleport this need into java space) that name change was needed on java side.

    Usually what you need for example non public java classes to make them public, change parameter names, but rarely types.

    Basically You have 2 problems reported from generator:

    1. 16+ parameters in method calls
      this is one I see for the first time. I'll check
    2. duplicate field which may be caused by #1

    I'll try to see if #1 can be solved easily.



  • SpartanSpartan USMember

    I was wondering if it makes sense to write a wrapper in java, and then expose the wrapper interface, which would then be used as a java binding. I do not have experience in java but is this something worth trying?

  • SpartanSpartan USMember

    Any help on this will be really appreciated.

  • SpartanSpartan USMember

    Still waiting (fingers crossed)...

  • DayaKumarDayaKumar USMember
    edited June 2015

    Still not getting after add-node in Metadata as
    add-node path="/api/package[@name='']/class[@name='Gimble']" /

    Error 341 The name 'Gimble' does not exist in the current context C:\ME PC\Xamarin Workspace\Beacon Sample\Beacon Sample\MainActivity.cs 35 13 Beacon Sample

    Please help.

  • DayaKumarDayaKumar USMember

    Error 332 'Com.Gimbal.Internal.Cache.CacheEntry' does not implement interface member 'Java.Lang.IComparable.CompareTo(Java.Lang.Object)'

    how to resolve. Plz help.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @moljac said:
    I have never had case where I needed to change the name of the class.

    I have a case for ya... The java class is named "2DeventArgs". C# won't let you start a class name with a number.
    The jar comes from a vendor. Sure I could perform a find/replace on the generated .cs file, but then it has to be done every time time the vendor updates the jar. Better to rename in the xml transform.

    Mind you this seems to be a problem, at least in latest Xamarin. The classes aren't renaming. At first I thought it was names that started with numbers.. but its starting to look like I can't rename any class, though I can rename methods, parameter etc. Weird.

Sign In or Register to comment.