I am using org.apache.legacy library in my xamarin project. I have added <uses-library>
tag in my manifest file but I get an error while building the project which says:
Unexpected element <uses-library> found in manifest.
Also when I try to comment that line, it comes back while building the solution.
uses-library tags should be placed within the application element, that's why you get the error.
the problem with the compiler complaining about the same line even if you change it can most likely be solved by restarting Xamarin studio, and then cleaning the project and rebuilding.
Ok, so one of my co workers found the solution to this, but it's weird. So, for context we use Visual Studio for Mac so this might not be 100% compatible with Windows. The issue we found was that Visual Studio has several different views for the AndroidManifest.xml file and one of the views was modified at some point in the past.
OpenWith -> 'Source Code editor'
. This view is a minimalistic view of the manifest in xml that can be edited. In here you should also find the problem line about the apache library that is not in the application tag as it should be. So, you can remove it here. Manifest UI View -> Manifest intermediate xml view -> Manifest generated file
It seems that you can only modify one version of the manifest file in xml since the other will always overwrite your changes. By following the error message you only get to the final output and not the intermediary Manifest that can actually be edited and maintain its changes. There was a modification to the manifest a long time ago in our project that is just now throwing errors with the newest release of Visual Studio.
The suggested fix is to not follow the error message to open the Manifest and instead open the manifest file in xml raw. It will be a smaller file than the generated one so look for that to know you're in the right place. Remove the uses-library line that is incorrectly placed outside of the Application tag and save. Hope this helps somebody else cause it definitely caught me up for a few hours.
So after spending few nights on this stupid bug, I created a whole new app from scratch and configured/installed all the packages and SDKs for using Google Maps in Xamarin android native and this time I put the tag inside the application tag and installed the app on my device and it worked absolutely fine. Hope it helps !! Cheers !!
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