“Package does not exist” error using Android v4 Compatibility Library

我的未来我决定 提交于 2019-12-23 02:29:44

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/13361613/package-does-not-exist-error-using-android-v4-compatibility-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!