Build Xamarin Android Project Unsucessfully,error Xa4212
Solution 1:
Following @Ironman answer, this happens with Xamarin.Android 8.0, so I set the property to false in the project .csproj file in the following section.
<PropertyGroup><!-- Other properties --><AndroidErrorOnCustomJavaObject>false</AndroidErrorOnCustomJavaObject></PropertyGroup>
In most cases you should add the property as it doesn't exist by default.
Now you can build and run the app normally, only with a warning.
Beware that are other PropertyGroup tags inside the .csproj file, that are specific to build conditions.
You can see the other build properties and configurations in https://github.com/xamarin/xamarin-android/blob/master/Documentation/build_process.md
Solution 2:
AndroidErrorOnCustomJavaObject :
A boolean property that determines whether types may implement
Android.Runtime.IJavaObject
without also inheriting fromJava.Lang.Object
orJava.Lang.Throwable
:
classBadType : IJavaObject {
public IntPtr Handle {
get {return IntPtr.Zero;}
}
publicvoidDispose()
{
}
}
When True, such types will generate an XA4212 error, otherwise a XA4212 warning will be generated.
Support for this property was added in Xamarin.Android 8.1.
This property is True by default.
Solution 3:
I had to Inherit Lava.Lang.object and removed Android.Runtime.IJavaObject to fix the issue.
Solution 4:
I fixed this by right clicking the solution and choosing Clean. If you get a message asking you to verify the project is selected to be deployed in the Solution Configuration Manager after you try cleaning, you can find instructions on how to resolve that issue here.
Solution 5:
So I ran into this error as well upon updating visual studio. I finally tracked it down to the csproj still pointing to the v4.1 version of mono.android. Going in and pointing it to the newest version (8.1 as of my writing) corrected it for me.
<Reference Include="Mono.Android">
<HintPath>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.1\Mono.Android.dll<HintPath> </Reference>
Post a Comment for "Build Xamarin Android Project Unsucessfully,error Xa4212"