PlatformException(no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null) in flutter

1,097

I Found the answer and it worked for me. Here it is just replace your code with following code in MainActivity.kt file.

package //your package name for eg.com.example.filename

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);
    }
}
Share:
1,097
ReX
Author by

ReX

Updated on December 20, 2022

Comments

  • ReX
    ReX over 1 year

    I am trying add Figureprint authentication using local_auth package of flutter i used same example given that package here it is. And i am getting this error

    I/flutter (27676): PlatformException(no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null)
    

    I have try this solution But the problem is that I don't know about kotlin.

    Here is my Mainactivity.kt

    package com.example.bio_met
    
    import io.flutter.embedding.android.FlutterActivity
    
    class MainActivity: FlutterActivity() {
    }
    
  • Tizi Dev
    Tizi Dev over 3 years
    this code works if I run on Emulator but if I build APK for my Android the Application crash at starting
  • ReX
    ReX over 3 years
    @TiziDev can show me logs while it's crashing. you see the logs in the android studio logcat tab on the bottom while running the app connect your phone to the system to see logs.
  • Tizi Dev
    Tizi Dev over 3 years
    Below I have posted the Log from Note Pro 9 Xiamei, the application crash after installing APK
  • ReX
    ReX about 3 years
    Sorry but I can't understand what is happing but you can open an issue on the GitHub repo of "Flutter" there you will get help or search on issues selection there for same error if anyone already solved.