Since VS2019, I have noticed that every new project has regular XML as its resources like native Android Studio applications, but previously (2015 or 2017) it created AXML files.
Internally, the files looked exactly the same, but recently I'm getting new bugs in Xamarin.Android in each new release in VS2019 (Windows or Mac), for example:
Perhaps, I should use AXML files as an uncommon comment came yesterday:
The linker removes classes that are needed and apparently doesn't parse the axml to see that they are in fact needed
This situation makes me wonder if there is any specific difference between them because when I run my app it works perfectly fine while it's not for Release or certain configurations like linking all assemblies.
Important note:
As my title of the question says: I'd like to know the difference between both extensions since for any reason the extension changed without any notice. The previous situations only raised my curiosity about this situation, they are not necessary linked.
AXML is just supported/available for Xamarin.Android. XAML is the way Xamarin Forms could standardize Cross Platform UI based on XML specification. If you are using native Xamarin Android you will do UI using axml, if using Forms then using XAML.
Xamarin Android has always used the .axml and there is no documentation of any change and the current documentation still references its use. I can work around it with some manual changes for now. If your app is Xamarin.Android then I don't understand your problem. What do you have to work around?
.axml is nothing more than an extension hack that was used to render Android Layout Filesi.e. Android flavored .xml files inside Visual Studio. It literally meant .axml (Android XML). We previously lacked infrastructure to interpret flavored versions of .xml files coming from all different types of workloads.
XAML is a type of declarative language, which has been derived from XML. Thus, all the documents that come under Xaml are also authentic to XML. Its use is extensive in designing the window’s controls and other web apps. It focuses on the properties of objects, their definition, and the relationship between all of them.
.axml is nothing more than an extension hack that was used to render Android Layout Files
i.e. Android flavored .xml files inside Visual Studio. It literally meant .axml (Android XML).
We previously lacked infrastructure to interpret flavored versions of .xml files coming from all different types of workloads. However in 16.2 and 8.2 respectfully (Visual Studio and Visual Studio for mac), you can use .xml
seamlessly in your application and be provided a layout editor, rich intellisense, and more.
If you don't require a layout editor, you have been able to use .xml since the first release of MonoDroid as .axml
is processed the same way as .xml
at the end of the day.
First, the linker does not do anything with your layout files. So .axml or .xml, it just won't touch it or parse it. The linker only work with the classes represented by the layout files, not the layout files themselves.
Now, regarding the ".axml" versus ".xml" I believe the ".axml" extension is just a legacy thing from MonoDroid. The only goal of that specific extension was probably to identify android layout files, from regular xml files, without any advanced logic (it's only a supposition).
Long story short, if you're facing issues in your project regarding the linker, it's probably not related to your extension choice for layout files. You should keep whatever Visual Studio defines as the default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With