Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
333 views
in Technique[技术] by (71.8m points)

xamarin - Failed to use Android Support Library v4

I'm trying to use the DrawerLayout from android.support.v4 library. I have added Xamarin.Android.Support.v4 package using Nuget but I'm still not able to compile the application and I face the following errors:

    Error   1    error: cannot find symbol
        android.support.v4.content.Loader.OnLoadCanceledListener
  symbol:   class OnLoadCanceledListener
  location: class Loader
    xxxobjDebugandroidsrcmonoandroidsupportv4contentLoader_OnLoadCanceledListenerImplementor.java 8   36  xxx
Error   6    error: cannot find symbol
        android.support.v4.view.MenuItemCompat.OnActionExpandListener
  symbol:   class OnActionExpandListener
  location: class MenuItemCompat
    xxxobjDebugandroidsrcmonoandroidsupportv4viewMenuItemCompat_OnActionExpandListenerImplementor.java    8   41  xxx
Error   7    error: cannot find symbol
        android.support.v4.view.OnApplyWindowInsetsListener
  symbol:   class OnApplyWindowInsetsListener
  location: package android.support.v4.view
    xxxobjDebugandroidsrcmonoandroidsupportv4viewOnApplyWindowInsetsListenerImplementor.java  8   26  xxx
Error   12   error: cannot find symbol
        android.support.v4.view.ViewPropertyAnimatorListener
  symbol:   class ViewPropertyAnimatorListener
  location: package android.support.v4.view
    xxxobjDebugandroidsrcmonoandroidsupportv4viewViewPropertyAnimatorListenerImplementor.java 8   26  xxx
Error   13   error: cannot find symbol
        android.support.v4.view.ViewPropertyAnimatorUpdateListener
  symbol:   class ViewPropertyAnimatorUpdateListener
  location: package android.support.v4.view
    xxxobjDebugandroidsrcmonoandroidsupportv4viewViewPropertyAnimatorUpdateListenerImplementor.java   8   26  xxx
Error   10   error: cannot find symbol
    private native android.support.v4.view.WindowInsetsCompat n_onApplyWindowInsets (android.view.View p0, android.support.v4.view.WindowInsetsCompat p1);
  symbol:   class WindowInsetsCompat
  location: package android.support.v4.view
    xxxobjDebugandroidsrcmonoandroidsupportv4viewOnApplyWindowInsetsListenerImplementor.java  32  128 xxx
Error   11   error: cannot find symbol
    private native android.support.v4.view.WindowInsetsCompat n_onApplyWindowInsets (android.view.View p0, android.support.v4.view.WindowInsetsCompat p1);
  symbol:   class WindowInsetsCompat
  location: package android.support.v4.view
    xxxobjDebugandroidsrcmonoandroidsupportv4viewOnApplyWindowInsetsListenerImplementor.java  32  40  xxx
Error   8    error: cannot find symbol
    public android.support.v4.view.WindowInsetsCompat onApplyWindowInsets (android.view.View p0, android.support.v4.view.WindowInsetsCompat p1)
  symbol:   class WindowInsetsCompat
  location: package android.support.v4.view
    xxxobjDebugandroidsrcmonoandroidsupportv4viewOnApplyWindowInsetsListenerImplementor.java  27  118 xxx
Error   9    error: cannot find symbol
    public android.support.v4.view.WindowInsetsCompat onApplyWindowInsets (android.view.View p0, android.support.v4.view.WindowInsetsCompat p1)
  symbol:   class WindowInsetsCompat
  location: package android.support.v4.view
    xxxobjDebugandroidsrcmonoandroidsupportv4viewOnApplyWindowInsetsListenerImplementor.java  27  32  xxx
Error   2    error: package android.support.v4.media.session.MediaSessionCompat does not exist
        android.support.v4.media.session.MediaSessionCompat.OnActiveChangeListener
    xxxobjDebugandroidsrcmonoandroidsupportv4mediasessionMediaSessionCompat_OnActiveChangeListenerImplementor.java   8   54  xxx
Error   3    error: package android.support.v4.os.CancellationSignal does not exist
        android.support.v4.os.CancellationSignal.OnCancelListener
    xxxobjDebugandroidsrcmonoandroidsupportv4osCancellationSignal_OnCancelListenerImplementor.java    8   43  xxx
Error   4    error: package android.support.v4.view.ActionProvider does not exist
        android.support.v4.view.ActionProvider.SubUiVisibilityListener
    xxxobjDebugandroidsrcmonoandroidsupportv4viewActionProvider_SubUiVisibilityListenerImplementor.java   8   41  xxx
Error   5    error: package android.support.v4.view.ActionProvider does not exist
        android.support.v4.view.ActionProvider.VisibilityListener
    xxxobjDebugandroidsrcmonoandroidsupportv4viewActionProvider_VisibilityListenerImplementor.java    8   41  xxx
Error   14   error: package android.support.v4.widget.SwipeRefreshLayout does not exist
        android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener
    xxxobjDebugandroidsrcmonoandroidsupportv4widgetSwipeRefreshLayout_OnRefreshListenerImplementor.java   8   47  xxx

It seems to me that I should add a jar or something like that to the Xamarin project, Please tell me how and where could I do this if I'm right at this point. Thanks for any help

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For me this was caused by killing VS during the initial build of my first Xamarin project after a reinstall.

It looked as though the process had hung, but apparently it was downloading from google at a slow rate.

Quit Visual studio

Delete / rename c:UsersusernameAppDataLocalXamarin

Open the solution again

Clean the solution

Compile, wait until it finishes completely.

On Windows, use Resource Monitor to determine if a download is in progress.

MSBuild will be downloading from something.1e100.net.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...