适用于Android Studio库的Android(Xamarin)绑定项目

时间:2017-07-17 09:53:15

标签: android xamarin calendar

我正在尝试将android中的外部库用于我的Xamarin.Android应用程序,但我遇到了很多问题。

我需要的外部库是一个日历库。在查看Xamarin Component的有限日历库集合后,我无法找到适合我的应用程序需求的集合。然后,我使用this Xamarin tutorialthis youtube tutorial阅读了使用Android Studio外部库的信息。

然而,在我试过的两个库中 -

两者都无法建立。

当我尝试构建材质日历视图时,这是错误列表:

The type or namespace name 'CalendarPagerView' does not exist in the namespace 'Com.Prolificinteractive.Materialcalendarview' (are you missing an assembly reference?)
'WeekView.ThresholdClass': no suitable method found to override
'WeekView.ThresholdType': no suitable method found to override
'WeekView.Rows': no suitable method found to override
'WeekView.BuildDayViews(ICollection<DayView>, Calendar)': no suitable method found to override
The type or namespace name 'DayView' does not exist in the namespace 'Com.Prolificinteractive.Materialcalendarview' (are you missing an assembly reference?)
'WeekView.IsDayEnabled(CalendarDay)': no suitable method found to override
'WeekView.OnClick(View)': no suitable method found to override
'WeekView.OnInitializeAccessibilityEvent(AccessibilityEvent)': no suitable method found to override
'WeekView.OnInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)': no suitable method found to override
'WeekView.SetDateTextAppearance(int)': no suitable method found to override
'WeekView.SetDayFormatter(IDayFormatter)': no suitable method found to override
'WeekView.SetMaximumDate(CalendarDay)': no suitable method found to override
'WeekView.SetMinimumDate(CalendarDay)': no suitable method found to override
'WeekView.SetSelectedDates(ICollection)': no suitable method found to override
'WeekView.SetSelectionColor(int)': no suitable method found to override
'WeekView.SetSelectionEnabled(bool)': no suitable method found to override
'WeekView.SetShowOtherDates(int)': no suitable method found to override
'WeekView.SetWeekDayFormatter(IWeekDayFormatter)': no suitable method found to override
'WeekView.SetWeekDayTextAppearance(int)': no suitable method found to override
'WeekView.ShouldDelayChildPressedState()': no suitable method found to override
'IExperimentalInvoker.Equals(Object)' hides inherited member 'Object.Equals(Object)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
'IExperimentalInvoker.GetHashCode()' hides inherited member 'Object.GetHashCode()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
'IExperimentalInvoker.ToString()' hides inherited member 'Object.ToString()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
The member 'WeekView.java_class_handle' does not hide an inherited member. The new keyword is not required.
The member 'WeekView.class_ref' does not hide an inherited member. The new keyword is not required.
Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.
top ancestor WeekPagerAdapter not found for nested type Com.Prolificinteractive.Materialcalendarview.WeekPagerAdapter.Weekly.
top ancestor MaterialCalendarView not found for nested type Com.Prolificinteractive.Materialcalendarview.MaterialCalendarView.IShowOtherDates.
top ancestor MaterialCalendarView not found for nested type Com.Prolificinteractive.Materialcalendarview.MaterialCalendarView.SavedState.1.
top ancestor MaterialCalendarView not found for nested type Com.Prolificinteractive.Materialcalendarview.MaterialCalendarView.4.
top ancestor MaterialCalendarView not found for nested type Com.Prolificinteractive.Materialcalendarview.MaterialCalendarView.ISelectionMode.
top ancestor MonthPagerAdapter not found for nested type Com.Prolificinteractive.Materialcalendarview.MonthPagerAdapter.Monthly.
top ancestor MaterialCalendarView not found for nested type Com.Prolificinteractive.Materialcalendarview.MaterialCalendarView.LayoutParams.
Unknown parameter type com.prolificinteractive.materialcalendarview.MaterialCalendarView in method OnRangeSelected in managed type Com.Prolificinteractive.Materialcalendarview.IOnRangeSelectedListener.
Invalid return type com.prolificinteractive.materialcalendarview.CalendarPagerView.LayoutParams in method GenerateLayoutParams in managed type Com.Prolificinteractive.Materialcalendarview.WeekView.
Invalidating Com.Prolificinteractive.Materialcalendarview.IOnRangeSelectedListener and all nested types because some of its methods were invalid.
top ancestor MaterialCalendarView not found for nested type Com.Prolificinteractive.Materialcalendarview.MaterialCalendarView.SavedState.
Unknown parameter type com.prolificinteractive.materialcalendarview.MaterialCalendarView in method OnDateSelected in managed type Com.Prolificinteractive.Materialcalendarview.IOnDateSelectedListener.
top ancestor MaterialCalendarView not found for nested type Com.Prolificinteractive.Materialcalendarview.MaterialCalendarView.1.
For StateBuilder, could not find enclosing type 'MaterialCalendarView'.
Unknown parameter type com.prolificinteractive.materialcalendarview.MaterialCalendarView in method OnMonthChanged in managed type Com.Prolificinteractive.Materialcalendarview.IOnMonthChangedListener.
Invalidating Com.Prolificinteractive.Materialcalendarview.IOnDateSelectedListener and all nested types because some of its methods were invalid.
Unknown parameter type com.prolificinteractive.materialcalendarview.MaterialCalendarView in method CalendarPagerView in managed type Com.Prolificinteractive.Materialcalendarview.CalendarPagerView.
top ancestor MaterialCalendarView not found for nested type Com.Prolificinteractive.Materialcalendarview.MaterialCalendarView.State.
Invalidating Com.Prolificinteractive.Materialcalendarview.IOnMonthChangedListener and all nested types because some of its methods were invalid.
top ancestor MaterialCalendarView not found for nested type Com.Prolificinteractive.Materialcalendarview.MaterialCalendarView.StateBuilder.
Unknown parameter type com.prolificinteractive.materialcalendarview.MaterialCalendarView in method WeekView in managed type Com.Prolificinteractive.Materialcalendarview.WeekView.
ignoring option UseSplitVerifier; support was removed in 8.0
missing class error was raised while reflecting com.prolificinteractive.materialcalendarview.MaterialCalendarView : android/support/v4/view/ViewPager$OnPageChangeListener
Couldn't load class com/prolificinteractive/materialcalendarview/MonthPagerAdapter : java.lang.NoClassDefFoundError: android/support/v4/view/PagerAdapter
Couldn't load class com/prolificinteractive/materialcalendarview/CalendarPager : java.lang.NoClassDefFoundError: android/support/v4/view/ViewPager
Couldn't load class com/prolificinteractive/materialcalendarview/MaterialCalendarView$3 : java.lang.NoClassDefFoundError: android/support/v4/view/ViewPager$PageTransformer
Couldn't load class com/prolificinteractive/materialcalendarview/CalendarPagerAdapter : java.lang.NoClassDefFoundError: android/support/v4/view/PagerAdapter
Couldn't load class com/prolificinteractive/materialcalendarview/MaterialCalendarView$2 : java.lang.NoClassDefFoundError: android/support/v4/view/ViewPager$OnPageChangeListener
Couldn't load class android/support/v4/view/BetterViewPager : java.lang.NoClassDefFoundError: android/support/v4/view/ViewPager
Couldn't load class com/prolificinteractive/materialcalendarview/WeekPagerAdapter : java.lang.NoClassDefFoundError: android/support/v4/view/PagerAdapter

Caldroid也会产生类似的错误列表。

我已经尝试直接使用现有的Xamarin库作为库,例如来自this question的库,但也有类似的构建问题,这让我相信我可能做了一些明显错误的事情,但我不能搞清楚。

由于我对Android开发很陌生,因此绑定这个精确库的分步指南将帮助我解决很多问题。

--- ---更新

在构建库并将其作为参考添加到我的项目中之后,在对象浏览器中查看库显示它是空的。

Object browser

缺少成员和错误:

Object browser 2

1 个答案:

答案 0 :(得分:1)

在项目解决方案中,您可以选择Add Existing Project,在Xamarin.MaterialCalendarView项目中添加MaterialCalendarLibrary

然后您可以关注此Xamarin tutorial,以使用material-calendarview。一切正常,如果我找到了更好的解决方案,我会回来更新这个答案。

效果如this

编辑:

object browser