small medium large xlarge

14 Jun 2016, 16:58
H. Paul Robertson (9 posts)

I’m working on the Xamarin chapter now. In Day 1, in the Android section, it says to use NuGet to get the v7 AppCompat library, which I did.

Now I’m trying to change the base class in MainActivity.cs to AppCompatActivity but I can’t get it to work. I looked in the code download to find the package name. It looks like it should be the following:

using Android.Support.V7.App;

However, my Xamarin Studio doesn’t recognize that package. In the Solution panel I expanded the “Packages” folder and I see Xamarin.Android.Support.v7.AppCompat but the using statement doesn’t work, and I haven’t been able to find any other package that works for AppCompatActivity.

I’m on the latest version of Xamarin Studio (6.0 build 5174). NuGet gave me v23.3.0 of the AppCompat library.

14 Jun 2016, 17:54
H. Paul Robertson (9 posts)

Figured this one out too.

For some reason NuGet downloaded the libraries but didn’t add a reference to them. I right-clicked on Calc.Droid > References and chose “Edit” then the “.Net Assembly” tab. I chose “Browse…” and browsed to the actual location of the .dll files (I had to add two – the v7.AppCompat.dll and the v4.dll.) For the location of the dlls I just looked at the other ones that were already in the list.

15 Jun 2016, 14:52
Tony Hillerson (39 posts)

I had lots of little issues like this with Xamarin Studio. It’s hard to get them into the book, since they’re intermittent, but at the very least, thank you for posting solutions here.

You must be logged in to comment