I am using a multi-targeting library in my Xamarin forms application. The library has come code written with __ANDROID__
conditional compiler symbol. When i run the application on Android, it does not execute the code written with the symbol.
The multi-targeting library project is using MSBuild.Sdk.Extras.
<Project Sdk="MSBuild.Sdk.Extras" ToolsVersion="16.0">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;MonoAndroid90</TargetFrameworks>
</PropertyGroup>
I also tried it by defining conditional symbol in Xamarin.Android Project Properties --> Build --> General --> Conditional compilation symbols. But it still does not run that particular code.
#if __ANDROID__
// do some andoid specific work
#endif
It should run this code block when running the application on Android.