我正在尝试使用颤振包添加 Figureprint 身份验证local_auth我使用了相同的示例,因为该包在这里。 我收到此错误
I/flutter (27676): PlatformException(no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null)
我已经尝试了这个解决方案,但问题是我不了解kotlin。
这是我的主要活动.kt
package com.example.bio_met
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
我找到了答案,它对我有用。在这里,它只是将您的代码替换为MainActivity.kt文件中的以下代码。
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);
}
}
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(Unknown Source:90)
at it.wytex.vibeland_client.MainActivity.l(Unknown Source:5)
at io.flutter.embedding.android.i.l(Unknown Source:10)
at io.flutter.embedding.android.e.k(Unknown Source:58)
at io.flutter.embedding.android.i.x0(Unknown Source:10)
at androidx.fragment.app.Fragment.c1(Unknown Source:21)
at androidx.fragment.app.j.R0(Unknown Source:433)
at androidx.fragment.app.o.b(Unknown Source:206)
at androidx.fragment.app.o.c(Unknown Source:18)
at androidx.fragment.app.o.C(Unknown Source:36)
at androidx.fragment.app.j.n0(Unknown Source:110)
at androidx.fragment.app.j.Z0(Unknown Source:88)
at androidx.fragment.app.j.l0(Unknown Source:21)
at androidx.fragment.app.j.e0(Unknown Source:9)
at androidx.fragment.app.j.y(Unknown Source:6)
at androidx.fragment.app.f.c(Unknown Source:4)
at androidx.fragment.app.d.onStart(Unknown Source:15)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1433)
at android.app.Activity.performStart(Activity.java:7923)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3332)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7562)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)```