4

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
    xxx\obj\Debug\android\src\mono\android\support\v4\content\Loader_OnLoadCanceledListenerImplementor.java 8   36  xxx
Error   6    error: cannot find symbol
        android.support.v4.view.MenuItemCompat.OnActionExpandListener
  symbol:   class OnActionExpandListener
  location: class MenuItemCompat
    xxx\obj\Debug\android\src\mono\android\support\v4\view\MenuItemCompat_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
    xxx\obj\Debug\android\src\mono\android\support\v4\view\OnApplyWindowInsetsListenerImplementor.java  8   26  xxx
Error   12   error: cannot find symbol
        android.support.v4.view.ViewPropertyAnimatorListener
  symbol:   class ViewPropertyAnimatorListener
  location: package android.support.v4.view
    xxx\obj\Debug\android\src\mono\android\support\v4\view\ViewPropertyAnimatorListenerImplementor.java 8   26  xxx
Error   13   error: cannot find symbol
        android.support.v4.view.ViewPropertyAnimatorUpdateListener
  symbol:   class ViewPropertyAnimatorUpdateListener
  location: package android.support.v4.view
    xxx\obj\Debug\android\src\mono\android\support\v4\view\ViewPropertyAnimatorUpdateListenerImplementor.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
    xxx\obj\Debug\android\src\mono\android\support\v4\view\OnApplyWindowInsetsListenerImplementor.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
    xxx\obj\Debug\android\src\mono\android\support\v4\view\OnApplyWindowInsetsListenerImplementor.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
    xxx\obj\Debug\android\src\mono\android\support\v4\view\OnApplyWindowInsetsListenerImplementor.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
    xxx\obj\Debug\android\src\mono\android\support\v4\view\OnApplyWindowInsetsListenerImplementor.java  27  32  xxx
Error   2    error: package android.support.v4.media.session.MediaSessionCompat does not exist
        android.support.v4.media.session.MediaSessionCompat.OnActiveChangeListener
    xxx\obj\Debug\android\src\mono\android\support\v4\media\session\MediaSessionCompat_OnActiveChangeListenerImplementor.java   8   54  xxx
Error   3    error: package android.support.v4.os.CancellationSignal does not exist
        android.support.v4.os.CancellationSignal.OnCancelListener
    xxx\obj\Debug\android\src\mono\android\support\v4\os\CancellationSignal_OnCancelListenerImplementor.java    8   43  xxx
Error   4    error: package android.support.v4.view.ActionProvider does not exist
        android.support.v4.view.ActionProvider.SubUiVisibilityListener
    xxx\obj\Debug\android\src\mono\android\support\v4\view\ActionProvider_SubUiVisibilityListenerImplementor.java   8   41  xxx
Error   5    error: package android.support.v4.view.ActionProvider does not exist
        android.support.v4.view.ActionProvider.VisibilityListener
    xxx\obj\Debug\android\src\mono\android\support\v4\view\ActionProvider_VisibilityListenerImplementor.java    8   41  xxx
Error   14   error: package android.support.v4.widget.SwipeRefreshLayout does not exist
        android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener
    xxx\obj\Debug\android\src\mono\android\support\v4\widget\SwipeRefreshLayout_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

a.toraby
  • 3,232
  • 5
  • 41
  • 73

3 Answers3

6

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:\Users\username\AppData\Local\Xamarin

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.

Michael Ribbons
  • 1,753
  • 1
  • 16
  • 26
5

It should just work by adding the NuGet package.

A couple of things to check.

  1. The full path to the files it cannot find if you are on a Windows file system cannot be more than 255 characters long
  2. Remove the NuGet package and try adding it again to see if that helps
  3. Make sure you have latest stable version of all the tools
  4. Make sure everything is ok in your Android SDK installation
Cheesebaron
  • 24,131
  • 15
  • 66
  • 118
  • Number 2 fixed the problem. Thanks. But I had to download the android_m2repository_r20.zip manually from somewhere else. May be something is wrong with my internet connection. – a.toraby Oct 12 '15 at 07:11
1

I had exactly this problem, and for me too this was a corrupt zip download - it was truncated. Because the zip was corrupt, it then didn't extract it and started complaining. Solution? download manually and replace the broken zip file (for me found here: C:\Users[User]\AppData\Local\Xamarin\Android.Support.v4\23.0.1.3)

Kinetic
  • 700
  • 8
  • 15