2

See this question because it's very relevant. Note: this question doesn't provide a sufficient answer, but the answer to the reference mentions the MainActivity.java-file and how it works with the GeneratedPluginRegistrant.java-file.

I'm trying to find location based on coordinates, but when doing flutter run with Chrome debugging, I get this error:

Error: MissingPluginException(No implementation found for method placemarkFromCoordinates on channel
flutter.baseflow.com/geocoding)

Following the link of the aforementioned link, I believe there's something wrong with my MainActivity.kt file, which is empty (default). There's a generated file called GeneratedPluginRegistrant.java with this code:

public final class GeneratedPluginRegistrant {
private static final String TAG = "GeneratedPluginRegistrant";
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
  try {
    flutterEngine.getPlugins().add(new com.baseflow.geocoding.GeocodingPlugin());
  } catch(Exception e) {
    Log.e(TAG, "Error registering plugin geocoding,   com.baseflow.geocoding.GeocodingPlugin", e);
  }
  try {
    flutterEngine.getPlugins().add(new com.baseflow.geolocator.GeolocatorPlugin());
  } catch(Exception e) {
    Log.e(TAG, "Error registering plugin geolocator,   com.baseflow.geolocator.GeolocatorPlugin", e);
  }
}

}

How can I make the MainActivity.kt file reference this code? Or is there a separate solution?

ma22om
  • 93
  • 9
  • Does this answer your question? [Trying to find out the current location of the device, it is showing "MissingPluginException"](https://stackoverflow.com/questions/61803063/trying-to-find-out-the-current-location-of-the-device-it-is-showing-missingplu) –  Jan 02 '22 at 09:25
  • @JesvinVijeshS No, I reference this exact question because it's relevant, but doesn't provide an answer. Following the answer to this referenced question, the MainActivity.java-file gets mentioned, but my version of MainActivity is a Kotlin-file (as is all new Flutter projects) and my Kotlin-file also happens to be empty. – ma22om Jan 02 '22 at 20:14
  • this error happens after you added a package that contains native code and neither hot-reload or hot-restart pushes native code into the running dart VM, so have you tried restarting the app? – MD Ismail Alam Khan Jan 05 '22 at 19:00

0 Answers0