Xamarin Build Errors: Please Install Package Xamarin.Android.Support.v4

A 2 minute read, Posted on Wed, Mar 16, 2016 In Coding
Tags xamarin, xamarin forms, coding, troubleshooting

I was out of active Xamarin development for a couple months and recently wanted to jump back in and work on a couple new project ideas. I fired up VS2015 and created a project. It was then that I realized I had not installed the official Xamarin tools since I got my new Surface Book. So I decided it was a good idea to install that latest Xamarin Tools before I did anything else.

A while later after it all downloaded and installed I opened my project back up and was greeted by a full set of build errors. Since it was a brand new project and had almost no code added I decided that the best course of action was to just delete the solution and create a new one. After purging the files from the disk and creating a new solution I was still receiving build errors.

The most notable error was:

Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. Java library file C:\Users\<user>\AppData\Local\Xamarin\Android.Support.v4\23.0.1.3\embedded\classes.jar doesn't exist.

and sometimes errors like:

package android.support.v4.view.ViewPager does not exist android.support.v4.view.ViewPager.OnPageChangeListener

After a couple separate attempts to find anything helpful I gave up for a couple days while I got on with other projects.

Well, tonight I was determined to get my Xamarin system up and running and hit the web for solutions. I didn’t find anything definitive, but I came across this StackOverflow question that got me looking in the right direction.

I never had an error related to a failed download, but the target directory was the same location some of my error messages said files were missing from. So I downloaded the zip for my library version from google and extracted the contents to (should create a subdirectory ‘m2repository’):

C:\Users\<user>\AppData\Local\Xamarin\Android.Support.v4\23.0.1.3\content

I suspect this may continue to be a problem for some and over time you will need a different file, based on the API version you are using. In this case you can see that I was using v23 of the API (as shown by the version string 23.0.1.3). So, if in the future you are using a newer API, say v23, you will need to determine the version and insert it in the below URL.

https://dl-ssl.google.com/android/repository/android_m2repository_r<Version>.zip

so for v23 I needed:

https://dl-ssl.google.com/android/repository/android_m2repository_r23.zip

I hope this helps you (or me) in the future. But hopefully this is something that Xamarin (and now MS) can do some work to improve a developers experience. If I wasn’t already a Xamarin believer I might have been looking on to other methods of mobile development with less friction.

comments powered by Disqus