PlatformException(no_fragment_activity,local_auth插件要求活动为FragmentActivity。,null) [英] PlatformException(no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null) in flutter

查看:364
本文介绍了PlatformException(no_fragment_activity,local_auth插件要求活动为FragmentActivity。,null)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 local_auth 颤振包我使用了相同的示例,因为包在这里
并且我收到此错误

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)

我已经尝试过解决方案,但问题是我不了解 kotlin

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

这是我的 Mainactivity.kt

package com.example.bio_met

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}


推荐答案

我找到了答案,它对我有用。在这里,它只是用 MainActivity.kt 文件中的以下代码替换您的代码。

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);
    }
}

这篇关于PlatformException(no_fragment_activity,local_auth插件要求活动为FragmentActivity。,null)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆