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

This is the file where the problem is located (SwipeDismissLayout_OnDismissedListenerImplementor.java):
<br /> package mono.android.support.wear.widget;</p> <p>public class SwipeDismissLayout_OnDismissedListenerImplementor<br /> extends java.lang.Object<br /> implements<br /> mono.android.IGCUserPeer,<br /> android.support.wear.widget.SwipeDismissLayout.OnDismissedListener<br /> {<br /> /** @hide */<br /> public static final String __md_methods;<br /> static {<br /> __md_methods = <br /> "";<br /> 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);<br /> }</p> <pre><code>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 9

    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;
                }
            }
    
Sign In or Register to comment.