Getting The Visual Studio Android Emulator Working With Android Studio v2 Preview

This was much harder than it should've been.

Visual Studio offers an excellent Android emulator. It runs at native x86 on Microsoft's Hyper-V platform, so it's speedy and plays nice with other Hyper-V VMs and Windows Phone emulators.

Getting it to work was a bit tricky, though.

Lollipop VMs Won't Boot

First off, after installing I noticed that Lollipop VMs (API versions 21 and 22) just plain didn't boot. They would just hang at the "OS Starting..." screen until the emulator would finally timeout with an error. Looking at the VM through the Hyper-V console itself would reveal the error failed to read from /dev/hw_random which was fairly cryptic.

It was only after searching the web a little bit that I came across the solution:

My guess is that the problem is the new generation of processor you are using. Apparently the Hyper-V emulator fails while trying to load Android Api 21 or 22 virtual images.

 - Open Hyper-V Manager
 - Select the Lollipop Emulator Virtual Machine
 - Click Settings
 - Expand "Processor", select "Compatibility"
 - Enable  "Migrate to a physical computer with a different processor version"

After toggling this option, the emulator started very quickly.

VMs Don't Show Up in ADB

After successfully booting the VMs, I had trouble getting them to show up in ADB so that I could deploy to them. Turns out that the VS Android Emulator looks to a registry key to determine where your Android SDK is installed, as mentioned in the troubleshooting document.

Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools
Modify the Path registry variable to match the path to your Android SDK.

This key didn't exist on my machine (perhaps it was removed from whatever SDK ships with Android Studio 2 Preview). After adding it and restarting my VM, it showed up in ADB and I was able to deploy to it. Joy!

Lollipop running in the Visual Studio Android Emulator

Finally! A use for the Microsoft Touch Mouse!

I bought the Microsoft Touch Mouse awhile back... you know, this one:

Microsoft Touch Mouse

If you're not familiar with it, it provides a big touch surface on top for gestures. Gestures like swiping your thumb left and right to go back/forward in your web browser, triple finger swipe up or down to zoom in/out, etc.

Here's a demo of the zoom in gesture:

These gestures weren't extraordinarily useful for me... so I tended to just use the Touch Mouse like any old mouse. Until Windows 10 rolled around with virtual desktops. Mac users have been able to swipe back and forth on their trackpads to switch desktops forever, so why not the Touch Mouse?

It works!

Configuring the Touch Mouse for Windows 10 virtual desktops

I decided to use the double finger swipe gesture for desktop changes. A swipe left would move to the lefthand desktop, right to the righthand desktop, and up to bring up task view. Great.

The Microsoft Mouse and Keyboard Center allows you to bind macros to these gestures on the touch mouse, so all we have to do is bind the virtual desktop hot keys to the proper gestures.

These settings are located in the "Touch Settings" section.

Navigate to Touch Settings

Now we just find the gesture we want, and change it to the proper keyboard shortcut (Win + Ctrl + Right/Left arrow key)...

Set the key combination to Win+Ctrl+Right Arrow

Now, for task view this becomes a bit tricky... the "key combination" setting won't let you input "Win+Tab" as a key combination. So we need to use a macro instead.

Set the macro for task view

Use the "Insert Special Key" option to insert the Windows Key into the list. You'll have to right click on the Windows Key element inside of the Editor and hit "split", then add a tab key inside the "pressed" and "released" events.

Done! Now you can swipe between desktops like all of your hipster Mac friends!

Microsoft Camera Codec Pack on Windows 10 Technical Preview

I recently installed the Windows 10 Technical Preview (how exciting)! I'm loving the experience so far.

Recently, however, I was importing some photos from a Canon 5D, and noticed Windows wouldn't generate preview images for the RAW CR2 files. The Microsoft Camera Codec Pack is built to resolve this, however, upon opening the installer, it refuses to install due to the version of Windows I'm now running.

After some research, I found that I could modify MSI files with a tool called Orca from Microsoft. I was then able to remove the OS check from the MSI file and get it installed. Now my CR2 files show previews in Explorer, and are viewable in the Photos app!

I've included the MSI here, just in case you don't want to go through all the work that I did. Download it here.