在OnActionExpandListener上找不到符号

Bri*_*ins 7 c# android xamarin.android xamarin android-support-library

我正在为支持姜饼的Android应用程序添加v4支持.我添加了ActionBarSherlock,它引用了Xamarin.Android.Support.v4.还有对Mono.Android.Support.v4的引用.我还将android-support-v4.jar文件添加到SupportLib文件夹,并将Build Action设置为AndroidJavaLibrary.但是,我收到一个错误,我无法通过,这是:

/obj/Debug/android/src/mono/android/support/v4/view/MenuItemCompat_OnActionExpandListenerImplementor.java(41,41): Error:  cannot find symbol
    symbol  : class OnActionExpandListener
    location: class android.support.v4.view.MenuItemCompat
            android.support.v4.view.MenuItemCompat.OnActionExpandListener
Run Code Online (Sandbox Code Playgroud)

为什么会发生这种错误?怎么解决?

Tom*_*rth 13

你不能同时引用Xamarin.Android.Support.V4Mono.Android.Support.V4.

我建议引用就像Xamarin.Android.Support.V4它是Android支持库v4的更新绑定一样.删除Mono.Android.Support.V4android-support-v4.jar.

  • 即使在删除Mono.Android.Support.v4后,我仍然会收到此错误,必须清理项目以使其构建.希望这有助于某人. (9认同)