I\'m looking to bind the YouTubeAndroidPlayerApi.jar into my Xamarin Android project. I\'ve added the YouTubeAndroidPlayerApi.jar under my Jars folder, but my project won\'
You should just be able to remove this fairly easily. However your issue in your <attr>
is the fact that you have the incorrect package name/class name as it should follow Java convention(<lowercase package>.<propercase class>
). Simply ensure the case like the example below:
EX:
<remove-node path="/api/package[@name='com.google.android.youtube.player']/class[@name='YouTubeThumbnailView']/method[@name='finalize' and count(parameter)=0]" />
If you add the remove-node
, you will remove the finalizer
and the code under finalize
method will never be called.
If you want to re-use the finalize
implementation in the destructor, you can add the following to your Metadata.xml
file:
<!--
YouTubeThumbnailView class implemented a Java Finalizer. I have to implement a C# Destructor and call the finalize method.
The C# Destructor is in the partial class under the Addition folder.
-->
<!-- I change the name of the finalizer method to avoid the conflict with java finalizer -->
<attr path="/api/package[@name='com.google.android.youtube.player']/class[@name='YouTubeThumbnailView']/method[@name='finalize' and count(parameter)=0]" name="managedName">InternalFinalize</attr>
<!-- I replace the protected override modifier with the internal modifier -->
<attr path="/api/package[@name='com.google.android.youtube.player']/class[@name='YouTubeThumbnailView']/method[@name='finalize' and count(parameter)=0]" name="visibility">internal</attr>
N.B. the visibility modifier is needed to remove the override
modifier.
Then you should add the following class under the folder Additions
:
namespace Com.Google.Android.Youtube.Player
{
public partial class YouTubeThumbnailView
{
~YouTubeThumbnailView()
{
this.InternalFinalize();
}
}
}