Upgrading to Xamarin Forms 3

Upgrading between major versions of Xamarin tends to break stuff and lead to projects no longer building due to weird errors. In their innocence, most devs will take these errors for real, try to understand them, to fix them and when they fail, they will Google them; when most of the times, the fix is to close Visual Studio, open it back up, and then do a clean build of your solution. Now let’s have a look at Xamarin Forms 3 (bear in mind this is a pre-release version, so these might be solved by the time of  the actual release).

Open up your existing project, or create a new Master Detail project using .NET Standard.

https://lh5.googleusercontent.com/jR42Oj0Cy0aiBtQBVAUkYe30rHALlzAc3sQAMl9mdVQTWM-x5f-05fbSv-_g077SfSVW21HMUpl20v6oNo2NhYNqYSKhxIAD-_x_MnkdJDSNbHxfJWqu8Igs4BoElnEMPihkLdcf

Build your project, see that it runs. Now go ahead and manage the NuGet packages for your solution. If you’re working with a pre-release version like I am, tick the “Include prerelease” box.

https://lh5.googleusercontent.com/zegQ1Tc013ZHQ78noWYnAVzosNpyM3WAL6L8rzMbVnzDbK2CkuhfZ0zXc47XAD_Xt2D8_dPp1R-6_oDDzw-1theM3HafhxPOtyFxcLK9AuPIfWXyijhf9uFsDnjcnUrTXBNE6oUC

Select all packages and Update. If you try a build now, you should be getting some errors about GenerateJavaStubs failing and the XamlFiles parameter not being supported by the XamlGTask.

https://lh3.googleusercontent.com/ntcFRKOfzWXvAGpeRG2KdSjFzGVnz8YMlKtkzhuF8B-HtB-KU-zDQTDheQTsHHrL0jdVdywn_5OPYi64ByPUwDKdQv39efni7M4ITuwkNK0t0GwUR84xAAF6tdIW3y0OS-u4BIpr

Ignore them, close Visual Studio (VS might throw an error about some task being cancelled; ignore that too), open VS back up again, clean your solution and rebuild – you know, like a true developer.

After this, if you’re working with a new project & building for Android, you’re getting the Java max heap size error.

https://lh4.googleusercontent.com/qEIOsiqPusYHVmL5dWPdx_0zvFSO18eKqGl3b7UO05o0bX6NIdWQNeyAs60Q5SvW-15TA0VP-joJq51etppIFdWlcCkZkE2PYIT60zytCaWCJt30h8uBPVgbPHskHUg1mwDfqwfI

Go to properties in your Android project, choose Android Options and click on Advanced at the bottom. Then type in “1G” for the Java Max Heap Size option. I wonder when they will decide to make this a default in new projects…

https://lh5.googleusercontent.com/ifYPQx9QNVe82obLY-pSDnSpIAdmZTX4i08NCl7p-RPMJG6wdWII8H-9dZC9Y8H23t64NFD_kfdeI-bBf5W8TX4UGYD1s3XOtue6hoGqs_KgFs9mTUt9Mo7prPMZiDJMJcJEVCLg

Build again, and voila! It’s working now.

https://lh4.googleusercontent.com/ZFsVbY8lMDCrnc_8HLf4_3dXoQ_u9LkXH02Z4vtQVszVHr6gdL1KsXkVGR6O9-nAMb3GZdEZrlg7nXxBvx7Alu-ID3P3WODnDf5IIQdjhmOxCxfrYslYNpodkmDvtAZvvp4wttPA




No Comments


You can leave the first : )



Leave a Reply

Your email address will not be published. Required fields are marked *

Are you a human? * Time limit is exhausted. Please reload the CAPTCHA.