Bug 59666 - System.MissingMethodException: Method 'Android.Support.Animation.SpringAnimation..ctor' not found.
Summary: System.MissingMethodException: Method 'Android.Support.Animation.SpringAnimat...
Status: RESOLVED FIXED
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components (show other bugs)
Version: Production (addons.xamarin.com)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jon Dick
URL:
Depends on:
Blocks:
 
Reported: 2017-09-21 19:23 UTC by Jon Douglas [MSFT]
Modified: 2017-10-05 20:38 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Reproduction (11.90 KB, application/x-zip-compressed)
2017-09-21 19:23 UTC, Jon Douglas [MSFT]
Details

Description Jon Douglas [MSFT] 2017-09-21 19:23:08 UTC
Created attachment 24863 [details]
Reproduction

## Description:

When trying to use SpringAnimation which is apart of the Dynamic Animation support library, it throws a System.MissingMethodException on the .ctor of the class.

09-21 16:05:20.368 E/mono    (30650): Unhandled Exception:
09-21 16:05:20.368 E/mono    (30650): System.MissingMethodException: Method 'Android.Support.Animation.SpringAnimation..ctor' not found.
09-21 16:05:20.368 E/mono-rt (30650): [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method 'Android.Support.Animation.SpringAnimation..ctor' not found.

I believe this also affects FlingAnimation as well.

## Reproduction:

Attached as SpringAnimationSample.zip

Open, Build, Run on device and attempt to drag the view and exception will occur.
Comment 1 Jon Douglas [MSFT] 2017-09-21 19:31:03 UTC
Additionally, the following constructors are missing from v26 Dynamic Animation which are included in v25:

SpringAnimation(View v, DynamicAnimation.ViewProperty property)
      : base(IntPtr.Zero, JniHandleOwnership.DoNotTransfer)

SpringAnimation(View v, DynamicAnimation.ViewProperty property, float finalPosition)
      : base(IntPtr.Zero, JniHandleOwnership.DoNotTransfer)

These constructors exist in the classes.jar inside the Resources of the v26 NuGet:

  public SpringAnimation(FloatValueHolder floatValueHolder)
  {
    super(floatValueHolder);
  }
  
  public <K> SpringAnimation(K object, FloatPropertyCompat<K> property)
  {
    super(object, property);
  }
  
  public <K> SpringAnimation(K object, FloatPropertyCompat<K> property, float finalPosition)
  {
    super(object, property);
    this.mSpring = new SpringForce(finalPosition);
  }
  
This is probably because we were binding to the deprecated methods of the v25 library:

  public SpringAnimation(FloatValueHolder floatValueHolder)
  {
    super(floatValueHolder);
  }
  
  public <K> SpringAnimation(K object, FloatPropertyCompat<K> property)
  {
    super(object, property);
  }
  
  public <K> SpringAnimation(K object, FloatPropertyCompat<K> property, float finalPosition)
  {
    super(object, property);
    this.mSpring = new SpringForce(finalPosition);
  }
  
  @Deprecated
  public SpringAnimation(View v, DynamicAnimation.ViewProperty property)
  {
    super(v, property);
  }
  
  @Deprecated
  public SpringAnimation(View v, DynamicAnimation.ViewProperty property, float finalPosition)
  {
    super(v, property);
    this.mSpring = new SpringForce(finalPosition);
  }
Comment 2 Jon Dick 2017-09-26 15:07:18 UTC
In the particular case about the sample not working out of the box, it looks like we're missing a dependency for the nuget package on some or all of support v4.

I added <PackageReference Include="Xamarin.Android.Support.v4" Version="25.4.0.1" /> to the sample and it appears to work.

Going to continue investigating the changes to v26.x
Comment 3 Jon Dick 2017-10-05 20:38:20 UTC
This should be fixed (manually) in the latest previews of 26.x

Note You need to log in before you can comment on or make changes to this bug.