Problem with building Android Wear

I am trying to create an Android Wear project with xamarin, but I cannot get my project to run.
I updated all the packages to the latest version

My android wear project is a standalone app so I set the minimum SDK version to 23.

These are the most important packages that I am using in my android wear project:
Xamarin.GooglePlayServices.Wearable: v42.1021.1
Xamarin.Android.Wear: v2.0.1.1
Xamarin.Android.Support.Wear: v26.1.0.1
Xamarin.Android.Support.v4: v26.1.0.1

I always get the following exception at starting my project:

1>obj\Debug\android\src\mono\android\support\wear\widget\SwipeDismissLayout_OnDismissedListenerImplementor.java:8: error: package android.support.wear.widget.SwipeDismissLayout does not exist
1> android.support.wear.widget.SwipeDismissLayout.OnDismissedListener
1> ^
1>obj\Debug\android\src\mono\android\support\wear\widget\SwipeDismissLayout_OnPreSwipeListenerImplementor.java:8: error: package android.support.wear.widget.SwipeDismissLayout does not exist
1> android.support.wear.widget.SwipeDismissLayout.OnPreSwipeListener
1> ^
1>obj\Debug\android\src\mono\android\support\wear\widget\SwipeDismissLayout_OnSwipeProgressChangedListenerImplementor.java:8: error: package android.support.wear.widget.SwipeDismissLayout does not exist
1> android.support.wear.widget.SwipeDismissLayout.OnSwipeProgressChangedListener
1> ^
1>Note: Some input files use or override a deprecated API.
1>Note: Recompile with -Xlint:deprecation for details.
1>Note: Some input files use unchecked or unsafe operations.
1>Note: Recompile with -Xlint:unchecked for details.
1>3 errors
1> error: package android.support.wear.widget.SwipeDismissLayout does not exist
1> android.support.wear.widget.SwipeDismissLayout.OnDismissedListener
1>
1> error: package android.support.wear.widget.SwipeDismissLayout does not exist
1> android.support.wear.widget.SwipeDismissLayout.OnPreSwipeListener
1>
1> error: package android.support.wear.widget.SwipeDismissLayout does not exist
1> android.support.wear.widget.SwipeDismissLayout.OnSwipeProgressChangedListener
1>
1>Done building project "NormalWearTest.csproj" -- FAILED.
1>Build FAILED.

This is the file where the problem is located (SwipeDismissLayout_OnDismissedListenerImplementor.java):

package mono.android.support.wear.widget;

public class SwipeDismissLayout_OnDismissedListenerImplementor
extends java.lang.Object
implements
mono.android.IGCUserPeer,
android.support.wear.widget.SwipeDismissLayout.OnDismissedListener
{
/** @hide */
public static final String __md_methods;
static {
__md_methods =
"";
mono.android.Runtime.register ("Android.Support.Wear.Widget.SwipeDismissLayout+IOnDismissedListenerImplementor, Xamarin.Android.Support.Wear, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", SwipeDismissLayout_OnDismissedListenerImplementor.class, __md_methods);
}

public SwipeDismissLayout_OnDismissedListenerImplementor ()
{
    super ();
    if (getClass () == SwipeDismissLayout_OnDismissedListenerImplementor.class)
        mono.android.TypeManager.Activate ("Android.Support.Wear.Widget.SwipeDismissLayout+IOnDismissedListenerImplementor, Xamarin.Android.Support.Wear, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] {  });
}

private java.util.ArrayList refList;
public void monodroidAddReference (java.lang.Object obj)
{
    if (refList == null)
        refList = new java.util.ArrayList ();
    refList.add (obj);
}

public void monodroidClearReferences ()
{
    if (refList != null)
        refList.clear ();
}

}

Answers

  • MarkHeinisMarkHeinis USMember ✭✭

    I have the same issue.. did you find a solution?

  • akersakers USMember
    edited February 2018

    Same issue here. Will there be a fix for it?

    I need that package because the "Xamarin.Android.Wear" package (Version 2.0.0.1) does not contain
    WearableLinearLayoutManager.LayoutCallback

    I need that to implement the scaling animation for the curved layout list:

    ...
    // Plug in the linear layout manager: CustomScrollingLayoutCallback customScrollingLayoutCallback = new CustomScrollingLayoutCallback(); mWearableRecyclerView.SetLayoutManager( new WearableLinearLayoutManager(this, customScrollingLayoutCallback));
    ...

    `
    public class CustomScrollingLayoutCallback : WearableLinearLayoutManager.LayoutCallback
    {
    /** How much should we scale the icon at most. */
    private static float MAX_ICON_PROGRESS = 0.65f;

        private float mProgressToCenter;
    
        public override void OnLayoutFinished(View child, RecyclerView parent)
        {
            // Figure out % progress from top to bottom
            float centerOffset = ((float)child.Height / 2.0f) / (float)parent.Height;
            float yRelativeToCenterOffset = (child.GetY() / parent.Height) + centerOffset;
    
            // Normalize for center
            mProgressToCenter = Math.Abs(0.5f - yRelativeToCenterOffset);
            // Adjust to the maximum scale
            mProgressToCenter = Math.Min(mProgressToCenter, MAX_ICON_PROGRESS);
    
            child.ScaleX = 1 - mProgressToCenter;
            child.ScaleY = 1 - mProgressToCenter;
        }
    }
    

    `

  • akersakers USMember

    Having the same problem, will there be a fix for this?

    I need that Xamarin.Android.Support.Wear: v26.1.0.1 nuget package because the Xamarin.Android.Wear: v2.0.1.1 package does not contain a definition for "WearableLinearLayoutManager.LayoutCallback".

    I use that class to animate the scaling when scrolling through a curved layout list:

        public class CustomScrollingLayoutCallback : WearableLinearLayoutManager.LayoutCallback
            {
                private static float MAX_ICON_PROGRESS = 0.65f;
    
                private float mProgressToCenter;
    
                public override void OnLayoutFinished(View child, RecyclerView parent)
                {
                    // Figure out % progress from top to bottom
                    float centerOffset = ((float)child.Height / 2.0f) / (float)parent.Height;
                    float yRelativeToCenterOffset = (child.GetY() / parent.Height) + centerOffset;
    
                    // Normalize for center
                    mProgressToCenter = Math.Abs(0.5f - yRelativeToCenterOffset);
                    // Adjust to the maximum scale
                    mProgressToCenter = Math.Min(mProgressToCenter, MAX_ICON_PROGRESS);
    
                    child.ScaleX = 1 - mProgressToCenter;
                    child.ScaleY = 1 - mProgressToCenter;
                }
            }
    
  • jesopojesopo Member

    Just a heads up to anyone finding this thread - I solved this by going from MonoAndroid 8.0 to 8.1 and going from to support libraries 26.1.0.1 to 27.0.2.1

Sign In or Register to comment.