title: Material Alert Dialog, The style on this component requires your app theme to be Theme.AppCompat
body: <p>I'm trying to make a  MaterialAlertDialog but I keep getting the following error no matter what</p>
  
  <pre><code> java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
          at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:243)
          at com.google.android.material.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:213)
          at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:148)
          at com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(ThemeEnforcement.java:76)
          at com.google.android.material.dialog.MaterialDialogs.getDialogBackgroundInsets(MaterialDialogs.java:60)
          at com.google.android.material.dialog.MaterialAlertDialogBuilder.&lt;init&gt;(MaterialAlertDialogBuilder.java:117)
          at com.google.android.material.dialog.MaterialAlertDialogBuilder.&lt;init&gt;(MaterialAlertDialogBuilder.java:103)
          at com.adamm.quem.MainActivity$1.onItemClick(MainActivity.java:118)
  </code></pre>
  
  <p>I am using a custom theme as my MainActivity theme which is a parent of MaterialComponents</p>
  
  <pre><code>&lt;style name="MainMaterialTheme" parent="Theme.MaterialComponents.Light.NoActionBar"&gt;
          &lt;item name="colorPrimary"&gt;@color/colorPrimary&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/colorPrimaryDark&lt;/item&gt;
          &lt;item name="colorAccent"&gt;@color/colorAccent&lt;/item&gt;
      &lt;/style&gt;
  </code></pre>
  
  <p>Changing the theme to AppCompat doesn't help and isn't really right to do
  I am following the implementation as Material IO explains <a href="https://material.io/develop/android/components/dialog/" rel="noreferrer">https://material.io/develop/android/components/dialog/</a></p>
  
  <p>My code:</p>
  
  <pre><code>AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getApplicationContext())
                              .setTitle("Title")
                              .setMessage("Message")
                      builder.show();
  </code></pre>
  
  <p>How can this be fixed?</p>