We launched the Xamarin Challenge two weeks ago, and like many of you, I’ve used this as a great excuse to learn the Xamarin developer experience. Here are a few general tips.
Note: I had hoped to be further along by now, but last week’s trip to Germany put a crimp in my plans. But I’m back up and running now.
Follow instructions carefully. Obvious, I know, but if you miss a crucial step, nothing is going to work.
Review the feedback in the Xamarin Challenge forum post. There is a lot of great feedback in the Xamarin Challenge forum post, so be sure to look through that, and to interact with the folks who actually created the challenge.
Learn Visual Studio, understand the terminology. For those who are unfamiliar with Visual Studio as well as Xamarin, the challenge can be a bit, well, challenging. But this kind of immersive experience is also a great way to learn Visual Studio. For multi-project solutions like those you’ll create using Visual Studio, it’s important to remember that you can build, deploy, and debug the project at any time, and I actually recommend doing so more frequently than is indicated in the challenge documentation. You build (compile, essentially) the entire solution. But you deploy and debug on a specific platform (Android, iOS, or Windows) and should make that the StartUp Project before you do so.
Collapse that tree. In many of the steps in Part 1, you are importing content into specific folders in the Visual Studio solution (many of which you create). Each time you do so, the Solution Explorer directory “tree” will expand at the node you are making changes. To keep things visually cleaner, I recommend closing the nodes of this tree as you go, to keep from getting confused. For example, if you’re working in CoolBreeze (Portable), make sure CoolBreeze.Android, CoolBreeze.iOS, and CoolBreeze.UWP (Universal Windows) are all fully collapsed.
Close files you’re not using. Likewise, you will add new files to the Solution in Part 1, and will replace the content of files with content provided by the documentation. As you complete working in each file, save it and close it.
Namespaces matter. One mistake I made while testing things was to start other Visual Studio projects and then forget that the project names (and resulting namespaces) matter. So, for example, if you create a second project called CoolBreeze2 or whatever, and then paste in the code we provide in the instructions, you’re going to see errors because that project will have a different namespace (“CoolBreeze2”) than is expected (“CoolBreeze”). I’m embarrassed to say I wasted time on this before I figured it out.
Run the Android emulator. The first time you deploy the app to the Android emulator, it takes forever and a day to launch. I recommend running the emulator first so it’s ready to go when you’re ready to deploy and debug. You do so by opening the Android Emulator Manager by clicking this button in Visual Studio’s Android toolbar.
Be patient. Some of the operations you’ll perform are time-consuming, in particular deploying to the Android emulator (as noted above). So pay attention to the Visual Studio status bar (at the bottom) when you kick off building, deploying, or debugging. It takes a while sometimes.
Tips for specific exercises in Part 1
Exercise 1. Here, you’re just installing the proper components needed to use Xamarin with Visual Studio. Pay particular attention to the “Individual Components” page when you modify Visual Studio: There are a number of options you have to enable there as well.
Exercise 2. Deploy and debug the solution before adding assets and resources in Exercise 2, and make sure it works. Does so with both Android and UWP (Windows) configured as the StartUp Project. There’s nothing quite like see the apps come up for the first time, especially when you can do so without errors in Visual Studio.
Exercise 3. This exercise is all about getting custom art into the app, in the Start menu in Windows, or on the Android home screen, and on the app splash screen. You might try testing the app after Step 13 and then again after Step 16, to see the difference this makes.
Exercise 4. This exercise neatly demonstrates the magic of Xamarin: Most of the code you’re adding here is common across all of the app versions, so it’s added to the CoolBreeze (Portable) project. Note that when Exercise 4 concludes, you cannot build the solution, as you’ll get an error related to App.RegistrationCode not being defined. That is defined in the next exercise.
Exercise 5. Here, you add some user interface. And then …
Exercise 6. Here, you can build, deploy, and debug the app across the supported platforms again. You should be able to do so with no errors, though to be fair I had to redo this challenge several times before I was able to claim victory.
On to Part 2…
Tagged with Xamarin