Sunday, 1 January 2017

Resolving TS5023:Build:Unknown compiler option

Make sure that you have the latest Visual Studio 2015 TypeScript Tools installed.

Tuesday, 15 November 2016

RestrictedCaptionAreaChangedEventArgs could not be resolved

I've just upgraded a Xamarin application to use the latest ReactiveUI 7.0.0 and got the following error when building in release mode:

error MSB4018: Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Reference to metadata item 'Android.Views.Window/RestrictedCaptionAreaChangedEventArgs' (defined in 'ReactiveUI.Events, Version=, Culture=neutral, PublicKeyToken=null') from 'ReactiveUI.Events, Version=, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed toresolve Android.Views.Window/RestrictedCaptionAreaChangedEventArgs

 RestrictedCaptionAreaChangedEventArgs was added in Xamarin Android 7.0 and is part of the API level 24 changes.

I needed to first install the Android SDK tools for API Level 24.  Open the Android SDK Manager and select 'Android SDK Build-tools' v24.0.3, 'SDK Platform Android 7.0' and 'ARM EABI v7a System Image'.

Then in my project properties I updated the 'Compile using Android version' and 'Target Android version' properties on the Application tab.

If you then get 'java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0', all you need to do is install the JDK 1.8 and update your JDK location in 'Tools\Options\Xamarin\Android settings'

Wednesday, 27 July 2016

Where to find Reactive Extensions 2.2.5

The latest and greatest Reactive Extensions v3 has been released.
With it came a name change to the NuGet packages:
  • Rx-Main is now System.Reactive
  • Rx-Core is now System.Reactive.Core
  • Rx-Interfaces is now System.Reactive.Interfaces
  • Rx-Linq is now System.Reactive.Linq
  • Rx-PlatformServices is now System.Reactive.PlatformServices
  • Rx-Testing is now Microsoft.Reactive.Testing
And the old packages have been unlisted.

If you have a need to install the older packages, as I have, then all you need to do is specify the version command line parameter when using Install-Package, which seems to be your only option.

Install-Package Rx-Main -Version 2.2.5

Check if Google Play Services are availble in Xamarin

This is actually pretty easy. Make sure you have Xamarin.GooglePlayServices.Gcm installed in your project.  Then use the following code:

Remember to call GoogleServices.Init(this) in your MainActivity after Forms.Init(this, bundle).

Tuesday, 26 July 2016

Android.Content.ActivityNotFoundException: No Activity found to handle Intent

I you get the following error message when trying to email using an Android emulator:
Android.Content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND_MULTIPLE typ=text/plain flg=0x10000000 (has extras) }
Then you most likely do not have email setup in the emulator.  Install Google Play on the emulator and setup an email account.

Wednesday, 20 July 2016


If you need to apply a FilterAttribute to all your MVC controllers and actions, but still be able to override the default behaviour, then you can use the following:
FilterProviders.Providers.Add(new DefaultFilterProvider<NoAuthorizeAttribute, AuthorizeUserAttribute>());

Saturday, 9 July 2016

Debug Android applications over Wi-Fi

Note to self:
  • Connect your Android device via USB, and make sure that USB debugging is working.
  • Open the Android Adb Command Prompt
  • Enter the following:
adb tcpip 5555

  • Find the IP Address of the device:
adb shell netcfg

  • Now connect to the device 

    adb connect <device.ip.address>:5555

    • You should now be able to disconnect the device from USB and be able to debug over Wi-Fi 

    Sunday, 29 May 2016

    java.lang.OutOfMemoryError. Consider increasing the value of $(JavaMaximumHeapSize). Java ran out of memory while executing 'java.exe'

    I was getting a java.lang.OutOfMemoryError while trying to compile a Xamarin Android application after adding HockeyApp.

    I found to ways to resolve this.

    The first option is to add a Environment Variable called _JAVA_OPTIONS and set it to -Xmx1g.  This sets the JVM heap size to 1GB.  You can either do this from the commandline by calling
    SET _JAVA_OPTIONS = -Xmx1g
    Or you can edit your system environment variables:

    The second and my preferred option was to to update the Java Max Heap Size in the Advanced Android Options tab in the Xamarin Android Visual Studio project:

    Wednesday, 18 May 2016

    The specified solution configuration “Debug|X64” is invalid

    I have a build script that finds all the solutions in a version control repository and builds them.  I do not specify the platform as many of the solutions and projects have different platform settings.

    Today in one of the branches my script started giving me the following error:
    The specified solution configuration “Debug|X64” is invalid
    Adding the following to the start of my build script solved this issue:

    Tuesday, 17 May 2016

    TFS: Undo checkout of unmodified files

    Here is another one of those shortcuts I have not been aware of. :D

    I hate TFS version control.  There are many reasons, but one irritating thing is that it is incapable of detecting if a file has actually changed or not.

    Here is a little commandline script you can run in your project to undo all unchanged files:
    tfpt uu . /noget /recursive
    Note: You need to install Team Foundation Server Power Tools.