Joshua Frank
Joshua Frank

Reputation: 13848

"Package does not exist" error using Android v4 Compatibility Library

I'm using MonoDroid 4.2 in Visual Studio 2010, and I'm trying to use ViewPager, Fragments, and other things from the Android v4 Compatibility Library.

I was able to add the project reference to Mono.Android.Support.v4.dll and at design time I get no errors and intellisense works fine.

But when I build, I get errors like this:

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

If I double-click on the error, it opens the source java file that MonoDroid creates on the fly, and goes to the line with the problem:

public class ViewPagerTestActivity_MyPagerAdapter
  extends android.support.v4.view.PagerAdapter

So it looks like Java can't find the library package, but I'm not sure why. Do I need to install that manually, and how do I tell MonoDroid where to find it?

Upvotes: 1

Views: 6050

Answers (1)

Joshua Frank
Joshua Frank

Reputation: 13848

After some research, I learned that I needed to actually install the support library. MonoDroid has .NET bindings for it, but the underlying java can't build without it, of course. Here are instructions for getting the support library and instructions for hooking it up to a MonoDroid project.

Upvotes: 4

Related Questions