title: Could not find custom method in androidx.appcompat.widget.TintContextWrapper for onClick handler in MaterialButton
body: <p>I have recently ported my app to material design and I have started to receive weird errors suggesting that methods are not found in activity (while they are and where there for last 3 years or so) and everything ends in crash for user. This seems to happen only to users that are running Android 4.* (4.0.2, 4.2, 4.4), various devices (Samsung and LG), any suggestions how to address it are appreciated! :)</p>
  
  <p>Full error message:</p>
  
  <blockquote>
    <p>Fatal Exception: java.lang.IllegalStateException Could not find a
    method <em>onCancelClicked</em>(View) in the activity class
    androidx.appcompat.widget.TintContextWrapper for onClick handler on
    view class com.google.android.material.button.MaterialButton with id
    '<em>btnCancel</em>'</p>
    
    <p>(...)</p>
    
    <p>Caused by java.lang.NoSuchMethodException onCancelClicked [class
    android.view.View]</p>
  </blockquote>
  
  <p>parts in italic are custom methods, see below for the layout</p>
  
  <pre><code>    &lt;com.google.android.material.button.MaterialButton
          style="@style/Widget.MaterialComponents.Button.TextButton"
          android:id="@+id/btnCancel"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:onClick="onCancelClicked"
          android:text="@string/dialog_conf_code_cancel" /&gt;
  </code></pre>
  
  <p>Activity handling this layout implements <code>AppCompatActivity</code>, while the <code>onCancelClicked</code> is simple, as below:</p>
  
  <pre><code>public void onCancelClicked(View v) {
      this.finish();
  }
  </code></pre>
  
  <p>I also get similar errors for other buttons implemented in this way, again - so far only for <em>some</em> users with Android 4.*.</p>
  
  <p>My dependencies in <code>build.gradle</code> are defined as below</p>
  
  <pre><code>dependencies {
      implementation 'com.google.android.material:material:1.0.0'
      androidTestImplementation 'androidx.test:runner:1.1.0'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
      implementation 'com.google.android.gms:play-services-ads:16.0.0'
      implementation fileTree(include: ['*.jar'], dir: 'libs')
      implementation 'com.google.firebase:firebase-core:16.0.5'
      implementation 'com.crashlytics.sdk.android:crashlytics:2.9.6'
      implementation 'com.android.support:appcompat-v7:28.2.0'
      implementation 'com.android.support:design:28.2.0'
  }
  </code></pre>
  
  <p>Again - any suggestions are appreciated! :)</p>