diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java index cf71acf0c2f..e8d2cc60cae 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java @@ -4,6 +4,8 @@ package io.flutter.embedding.android; +import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; + import android.content.Context; import android.content.Intent; import android.os.Build; @@ -25,8 +27,6 @@ import io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener; import io.flutter.plugin.platform.PlatformPlugin; import io.flutter.view.FlutterMain; -import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; - /** * {@code Fragment} which displays a Flutter UI that takes up all available {@code Fragment} space. *

@@ -228,7 +228,7 @@ public class FlutterFragment extends Fragment { public T build() { try { @SuppressWarnings("unchecked") - T frag = (T) fragmentClass.newInstance(); + T frag = (T) fragmentClass.getDeclaredConstructor().newInstance(); if (frag == null) { throw new RuntimeException("The FlutterFragment subclass sent in the constructor (" + fragmentClass.getCanonicalName() + ") does not match the expected return type.");