Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

What is the difference between api.xml.fixed and api.xml?

Sorry if some of these questions are quite trivial, I have literally just joined the world of Xamarin development and struggling with getting Java binding to work with a 3rd party Java library, so I have a couple of questions and appreciate any help on this please.

The binding generator creates an abstract class and an internal constructor, which I cannot create an instance of this class (there are no inherited classes from this either), so I have tried to modify the MetaData.xml but nothing changes in the output wrapper class.

I have looked in the obj/debug folder and I can see the api.xml and api.xml.fixed files, the api.xml file does not seem to have changes I have made in the MetaData.xml, while the api.xml.fixed does.

The following codes are extracted from my project to clarify my issue (Namespace and class name changed for various reasons - I hope I have changed the name correctly :smile: ):

Java class

package com.testjavalibrary;

import android.content.Context;
import com.testjavalibrary.TestException;

public final class TestManagerApi
    extends l
    {
       public TestManagerApi(Context context)
       throws TestException
       {
        super(context);
       }
    }

Metadata.xml

<metadata>
    <attr path="/api/package[@name='com.testjavalibrary']/class[@name='TestManagerApi']" name="name">ChangedTestClass</attr>
</metadata>

App.xml.fixed

<class abstract="false" deprecated="not deprecated" extends="com.testjavalibrary.l" extends-generic-aware="com.testjavalibrary.l" final="true" name="**ChangedTestClass**" static="false" visibility="public">
    <constructor deprecated="not deprecated" final="false" name="TestManagerApi" static="false" type="com.TestManagerApi" visibility="public">
           <parameter name="p0" type="android.content.Context">
           </parameter>
    </constructor>
....

App.xml

<class abstract="false" deprecated="not deprecated" extends="com.testjavalibrary.l" extends-generic-aware="com.testjavalibrary.l" final="true" name="TestManagerApi" static="false" visibility="public">
    <constructor deprecated="not deprecated" final="false" name="TestManagerApi" static="false" type="com.testjavalibrary.TestManagerApi" visibility="public">
       <parameter name="p0" type="android.content.Context">
       </parameter>
    </constructor>
....

Output wrapper class

namespace Com.Testjavalibrary {

    [Register ("com/testjavalibrary/ITestManagerApi", DoNotGenerateAcw=true)]
    public **abstract **class TestManagerApi : Java.Lang.Object {

        **internal** TestManagerApi ()
        {
        }
....

Questions:

i. What is the app.xml.fixed file? Why is this changed and does not apply to the result wrapper class? There is very little (or none) information on Google about this file.
ii. The output class is an abstract class, even though the App.xml attribute is abstract='false', how do I remove the abstract keyword please?
iii. The constructor is also changed into an internal rather than public constructor, again, you can see that in App.xml, the visibility attribute is set to public.

Sorry for so many questions, this has taken me 2 nights on the run to get this working (currently typing this at 5:15am), so any information or help would be really appreciated.

Sign In or Register to comment.