You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the fix in PR #1335 (which resolved missing AddOnChangeListener/AddOnSliderTouchListener methods), implementing Slider.IOnChangeListener or Slider.IOnSliderTouchListener in a .NET Android app causes a javac build error at ACW compilation time.
Error Message
javac error JAVAC0000:
BaseOnChangeListener cannot be inherited with different arguments:
<com.google.android.material.slider.Slider>
name clash: class SliderValueChangeListener has two methods
with the same erasure, yet neither overrides the other
first method: onValueChange(Slider, float, boolean) in BaseOnChangeListener
second method: onValueChange(Object, float, boolean) in SliderValueChangeListener
classSliderValueChangeListener:Java.Lang.Object,Google.Android.Material.Slider.Slider.IOnChangeListener{publicvoidOnValueChange(Google.Android.Material.Slider.Sliderslider,floatvalue,boolfromUser){// Handle value change}}// Usageslider.AddOnChangeListener(newSliderValueChangeListener());
Build the project → javac error during ACW compilation
Root Cause
The binding generates an erased OnValueChange(Object, float, bool) method on IBaseOnChangeListener (from the generic type parameter S). When the ACW creates a Java class implementing Slider.OnChangeListener (which extends BaseOnChangeListener<Slider>), Java sees two methods with the same erasure that don't override each other — causing the type clash.
The same issue affects BaseOnSliderTouchListener with OnStartTrackingTouch/OnStopTrackingTouch.
Expected Behavior
Implementing Slider.IOnChangeListener or Slider.IOnSliderTouchListener should compile and work without any javac errors.
Description
After the fix in PR #1335 (which resolved missing
AddOnChangeListener/AddOnSliderTouchListenermethods), implementingSlider.IOnChangeListenerorSlider.IOnSliderTouchListenerin a .NET Android app causes a javac build error at ACW compilation time.Error Message
Steps to Reproduce
Xamarin.Google.Android.Material(latest with PR Fixed Material Slider addOnChangeListener method missing issue #1335 fix)Root Cause
The binding generates an erased
OnValueChange(Object, float, bool)method onIBaseOnChangeListener(from the generic type parameterS). When the ACW creates a Java class implementingSlider.OnChangeListener(which extendsBaseOnChangeListener<Slider>), Java sees two methods with the same erasure that don't override each other — causing the type clash.The same issue affects
BaseOnSliderTouchListenerwithOnStartTrackingTouch/OnStopTrackingTouch.Expected Behavior
Implementing
Slider.IOnChangeListenerorSlider.IOnSliderTouchListenershould compile and work without any javac errors.Environment
Related
addOnChangeListenerfix that exposed this issueSliderandRangeSliderlistener implementations