Category Archives: Mobile

Getting Started in Xamarin Forms with Visual Studio 2017: Why Your First App Won’t Compile or Deploy

Visual Studio 2017 was just released with much fanfare, and if you work in the Windows world, your set of tools just got a major upgrade. One of the biggest toys in your new toolbox is the built-in support for Xamarin–a recent acquisition of Microsoft’s, and whose technology allows developers to write an app in C# that will deploy and run natively on iOS, Windows, and Android mobile devices. This is Really Big Stuff, and a technology which we’ll be spending a lot of time with in the coming years.

One of the more surprising aspects of the new Xamarin Forms support in Visual Studio 2017, however, is that the built-in templates for Forms-based projects don’t actually compile(!). These are the “Hello World” apps which are there to get novices (such as ourselves) started, so not being able to get them to… you know… work… is sort of unnerving.

After a couple of weeks dealing with Xamarin, here’s a few tips on how to get that first app running under Windows, using the Community edition of Visual Studio 2017. Hopefully Microsoft will fix much of this soon, but in the meantime, this article is for anyone who’s also getting their feet wet with Xamarin is might be getting flustered by the constant stream of errors standing between themselves and “Hello World”:

  1. You’ll likely need to install a new Windows SDK, or you’ll get errors when targeting different versions of Windows UWP. As soon as you choose to create a new “Cross Platform” project (iOS/Android/Windows), Visual Studio will go through the work of creating separate sub-projects for each one of these platforms. When it hits the UWP (Universal Windows Platform) one, you’ll be presented with a dialog asking you which version of Windows you want to target, and which level is the minimum you’ll support. Whatever you choose, there’s about an 80% change you don’t have the exact right version of the relevant Windows SDKs installed on your machine, and you’ll get a message with a “https://go.microsoft..” url as part of the error message. Copy that link into your browser’s address bar (the error message is not a hyperlink, unfortunately), and it’ll take you to the Windows  SDK download page. Install the relevant version, restart Visual Studio, and try again.

  2. Visual Studio Itself may need to be updated or you’ll get “(limited)” Mac Client connectivity and the iOS app won’t compile. After a day last week  spent wondering why my Mac Client was connecting with a “(limited)” next to the icon in the toolbar–and having the builds which worked the night before suddenly fail (and in desperation, spinning up a second Mac as a build computer only to have it also fail)–I discovered that Microsoft had just released a patch some 2 hours earlier to Visual Studio which solved the issue (itself likely caused by one of the Windows 10 updates that downloaded overnight). The solution: watch your “Notifications” in Visual Studio like a hawk, and download any updates you see there. You can also use Tools > Extensions and Updates to verify that you’ve got the very latest–and we do mean the very latest–updates.

  3. Your Android SDKs are out of date. If you want to work with the latest Android OSs (and you do), you’ll need to install more recent versions of the Android SDKs than are included with the Visual Studio 2017 install. The current versions of Xamarin (more on this later) also expect the Android SDKs to be updated. To do this, use Visual Studio’s Tools > Android > Android SDK Manager. Warning: the installs take a long time to complete, so throw on an episode or two of Breaking Bad before you kick them off.

  4. The default installed version of Xamarin is out of date, and will cause errors around InitializeComponent() in App.xaml.cs; when you try to compileThe solution: Before you do anything with a new project, right-click on the solution, go to Nuget Package Manager, click the Updates tab, and install all available updates. Then Do it Again as the Build component for Xamarin won’t update until the rest of it has updated. It’ll want to restart Visual Studio afterward, so do that too.

  5. Your Mac’s XCode and Xamarin also likely need updating. This is tedious. You’ll need the latest version of XCode… which in turn likely requires the latest version of the OS… along with the latest version of the Xamarin components (which you can get by downloading Xamarin Studio). It’s all pretty easily managed, but the installs take hours.

  6. The default project settings will nest the path too deeply and you’ll likely get deployment errors. By default, projects are created in the [My Documents]\Visual Studio 2017\Projects folder, creating a sub-folder for the project itself. Due to the depth of the folder nesting within the various sub-project folders, it’s far too easy to have some of the paths exceed Windows’ limit of 255 characters in the total path name. The solution: Don’t use the default location, and create the project’s directory as close to your drive’s root as possible.

  7. Your Android Devices need to be set up in developer mode to let you debug on the device. And trust me, after waiting several minutes for the emulators to boot up, you will want to debug on an actual device.The trick to turning on developer mode varies depending on the version of Android you’ve got. For mine (the “Marshmallow” version of Android), it involved tapping the Android OS version number a jillion times in a row under Settings. See http://www.androidcentral.com/android-50-lollipop-basics-how-turn-developer-settings or https://www.youtube.com/watch?v=TKIRXVhBvBY for more.

  8. Your iOS Devices need to be provisioned… and have their certificates set up… and a bunch of other stuff. The easiest way to handle all of this is through XCode. Start by paying the $99 to Apple to join their iOS developer program (you’ll need to bite the bullet and do it anyway if you distribute through their store), then connect your iOS device to your Mac, launch XCode, and follow the guide here: https://developer.xamarin.com/guides/ios/getting_started/installation/device_provisioning/Oh, and that part about needing to create a dummy app to get the proper provisioning profile installed? That’s actually real.

Hope these tips give you a smoother ride getting started. I’ll undoubtedly be blogging more on Xamarin in the future…

 

The New iPad: That’s It??

For the last few months, I’ve been anxiously awaiting news from both Microsoft and Apple as to what they’ll be doing with their latest rounds of tablets. I’m in the market for a new tablet, since my old iPad Retina 3 got passed on to my Mom ahead of what I expected to be a short wait for the next generation of mobile devices from the big guys.

As it turns out, both companies have gone over a year since the last major refresh of their tablet lines, so rather than throw down money on old technology, I’ve been holding out for news from both Cupertino and Redmond as to what new marvels they would bring forth with their new releases.

Redmond is still MIA on a new Surface Pro 5, but today, Apple ended the suspense with the release of their newest iPad (dubbed, simply “iPad”), which replaces last year’s iPad Air 2. Here it is:

ipad-wifi-select-spacegray-201703_GEO_US

Look familiar? It ought to. Because for all intents and purposes, it’s the same iPad as last year’s model. It’s got the same screen, same camera, same memory specs, same form factor, and a processor with a tiny speed-bump (the “A9” instead of the “A8x”)… oh, and it’s a little heavier.

But hey, at least they took $70 off the price.

Unsurprisingly, the new iPad was launched with zero fanfare. Indeed the news that got bigger interest is that they’ve refreshed the iPhone 7 lineup… by making it available in red. Yes, red. I can barely contain my excitement.

What happened to you, Apple? You used to be the folks who forced everyone else to innovate. And while I remain convinced that Apple is packed with smart and creative folks, we’re seeing blessed little of this potential realized in the products released since Tim Cook took the helm.

 

 

On Making the Switch to Sprint

With last Friday’s iPhone 4S launch, the stars were finally aligned to allow Carolyn and me to make the move off AT&T’s accursed network onto Sprint’s. It involved paying an early termination fee and buying new phones, but after the zillionth dropped call (even with our additional Microcell), we’d had enough.

A few thoughts on making the move:

– First off, reception is _way_ better–5 bars vs. 1-2 on AT&T.

– Carolyn can probably explain the reason for it, but the switch in network types also means the call defects are different. AT&T’s GSM network would just not make calls (call failed when dialing), or drop them suddenly with no reason. Afterward, it was typically hard to get a solid connection. The two times I’ve had problems with Sprint’s CDMA network, the calls got “static-y” for several seconds, then dropped. A call-back would result in a crystal-clear connection. Is this a cell tower/band switching thing?

– Data speed seems the same or better with Sprint. I’ve noticed, however, that most of my data traffic these days is moving over Wi-Fi (Thanks for the free Wi-Fi, Starbucks!), so 3G data may not be as important as it once was.

– I went with Sprint over Verizon mostly due to the total plan cost for a family being much higher on their network vs. Sprint’s.  I hear overall good things about their network, though.

– For the first time, I recouped a ton of cash with no trouble whatsoever by selling back my now-obsolete phones. Sprint has a buyback program which instantly credits you about $250 for an iPhone 4 and $180 for the old 3Gs Carolyn had been using. Redemption was as easy as bringing in the (wiped) old phones into the store. Nice! (I also got $100 instantly on eBay for the now-obsolete Microcell I’d bought in a vain attempt to have my phone calls improved at home by routing them over my stupidly fast internet connection here. The Microcell managed to deliver 5 bars, but just as many stuttery/dropped calls as before. I never figured out why, despite two advanced troubleshooting calls with AT&T).

– If you’re thinking of moving over to Sprint, make sure to take advantage of discounts available to credit union, AAA, or military folks. I hear there are often corporate discounts as well. The discounts tend to be about 10% of the monthly bill.