title: why GeneratedPluginRegistrant.registerWith(this) gives error in Flutter MainActivity.kt?
body: <p>GeneratedPluginRegistrant.java</p>
  <pre><code>package io.flutter.plugins;
  
  import androidx.annotation.Keep;
  import androidx.annotation.NonNull;
  
  import io.flutter.embedding.engine.FlutterEngine;
  import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;
  
  /**
   * Generated file. Do not edit.
   * This file is generated by the Flutter tool based on the
   * plugins that support the Android platform.
   */
  @Keep
  public final class GeneratedPluginRegistrant {
    public static void registerWith(@NonNull FlutterEngine flutterEngine) {
      ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine);
        net.goderbauer.flutter.contactpicker.ContactPickerPlugin.registerWith(shimPluginRegistry.registrarFor(&quot;net.goderbauer.flutter.contactpicker.ContactPickerPlugin&quot;));
        com.pichillilorenzo.flutter_appavailability.AppAvailability.registerWith(shimPluginRegistry.registrarFor(&quot;com.pichillilorenzo.flutter_appavailability.AppAvailability&quot;));
        io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin.registerWith(shimPluginRegistry.registrarFor(&quot;io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin&quot;));
        flutter.moum.hardware_buttons.HardwareButtonsPlugin.registerWith(shimPluginRegistry.registrarFor(&quot;flutter.moum.hardware_buttons.HardwareButtonsPlugin&quot;));
      flutterEngine.getPlugins().add(new vn.hunghd.flutter.plugins.imagecropper.ImageCropperPlugin());
      flutterEngine.getPlugins().add(new io.flutter.plugins.imagepicker.ImagePickerPlugin());
      flutterEngine.getPlugins().add(new io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin());
        com.lykhonis.simpleimagecrop.SimpleImageCropPlugin.registerWith(shimPluginRegistry.registrarFor(&quot;com.lykhonis.simpleimagecrop.SimpleImageCropPlugin&quot;));
    }
  }
  
  </code></pre>
  <p>MainActivity.kt</p>
  <pre><code>package com.example.flutterapp
  
  
  import android.os.Bundle
  import io.flutter.app.FlutterActivity
  import io.flutter.plugin.common.MethodChannel
  import io.flutter.plugins.GeneratedPluginRegistrant
  
  class MainActivity : FlutterActivity() {
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          GeneratedPluginRegistrant.registerWith(this)
      }
  }
  </code></pre>
  <p>I am getting error in line</p>
  <pre><code>GeneratedPluginRegistrant.registerWith(this)
                                         ^
  </code></pre>
  <p>I tried replacing it with flutterEngine too but it didn't work.
  I am actually creating an app that could run in background and for that I am using sharedPreferences. My code runs in a normal seperate project but it gives error in this one please help with this
  Thank you in advance!</p>