Xamarin.Forms Growing Pains
I've recently been tasked with playing around with Xamarin.Forms. In a nutshell, it is awesome, but I have encountered many small bugs that are quite inconveniencing for the novice.
I've recently been tasked with playing around with Xamarin.Forms. In a nutshell, it is awesome, but I have encountered many small bugs that are quite inconveniencing for the novice. This is probably due to it being a non-Microsoft product and still fairly immature. I'm sure with Microsoft's backing now, all these issues will soon be ironed out.
INSTALL_FAILED_UPDATE_INCOMPATIBLE and/or Ensure that the application has been installed to the target device and has a launchable activity (MainLauncher = true) These messages were appearing in the Output and Build Output Windows. I was attempting to run my program on a Nexus5x device.
Firstly, I uninstalled the existing installation of the app. I noticed that it said "uninstalled for this user". This was key to solving this issue as it was still installed! It needed to be uninstalled for all users!
Reference Issues Compiling Samples And Demos We're always being told to update everything on Windows to make it safe, therefore I think every Xamarin rookie I have talked to updates all nu-get packages immediately. Don't. Quite often the only package that needs updating is the Xamarin.Forms package. Don't touch the Android ones! Clean and rebuild will often sort our issues.
Out of memory building Android Apps This is usually fixed by increasing the Java Heap Size. by default the textbox is empty, but I usually enter 1G and rebuild.
Embedded resource is not supported by one of the projects during rebuild.
This is one of those generic errors that can be several things.
Firstly ensure that Xamarin.Forms package is up to date via the nuget package manager.
Clean and rebuild.
If the error persists, close Visual Studio and reopen.
If this doesn't work then start Googling.
Visual Studio Android Emulator Wont Start
I found on my i7 with 8Gb RAM I still got out of memory errors running the emulator. I usually have several things open at once, so I just close down some to free up enough memory. Simple!
Not Enough Android Emulators
There are thousands of different types of phone and Android version but Visual Studio Android emulator only seems to have two or three. If you open up the stand-alone Android Emulator utility, you'll discover there are a lot more emulators that can be downloaded. These are phones and tablets consisting of different versions of Android.
Android Bindings Library Not Showing Methods In Object Browser
If you add an .arr file to a binding library and set the BuildAction to be appropriate (such as InputJar or ReferenceJar) I often found that the methods that should've been shown in the Object Browser were not available after a rebuild. Closing Visual Studio fixed this. Obviously Object Browser does not automatically refresh!
Using Android Bindings causes message similar to locale::facet::Screateclocale name not valid I spent a while checking I had all the neccessary assets, JNI files and other files my library needed and that thei rproperties were set correctly. This still didn't work, so I turned to Google.
This Xamarin forum post has the solution, which is nice and simple:
Put this line in the OnCreate of the activity that will be calling the library
System.Environment.SetEnvironmentVariable ("LANG", "C");