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)

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


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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