local_auth: MainActivity.kt: (11, 48): Type mismatch: inferred type is FlutterEngine but PluginRegistry! was expected

Viewed 606

I'm using local_auth: ^ 0.6.3 + 4 and I got this error:

error using biometric auth: PlatformException(no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null, null)

I've tried the solutions from https://github.com/flutter/flutter/issues/33429 (see below), but none of them seem to work because I get this new error when building the application:

MainActivity.kt: (11, 48): Type mismatch: inferred type is FlutterEngine but PluginRegistry! was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.

Solutions tried:

package ...

import androidx.annotation.NonNull
//import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterFragmentActivity() {
    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine)
    }
}

and also this:

package ...

import android.os.Bundle;
import io.flutter.app.FlutterFragmentActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;

public class MainActivity: FlutterFragmentActivity()
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
  }
}
0 Answers
Related