Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 181 Vote(s) - 3.52 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error: PlatformException(no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null)

#1
Getting this error while using local_auth version 0.6.0
It's working fine for iOS but getting this error in android.
Already have implemented ```class MainActivity: FlutterFragmentActivity()``` but still getting this issue
Reply

#2
change your main activity to override FlutterFragmentActivity

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

class MainActivity: FlutterFragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
}
}

if you are using flutter embedding version 2



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

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

Reply

#3
I am using local_auth 0.6.2+3

My MainActivity.kt

package xx.xx.xxx
import androidx.annotation.NonNull;
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);
}
}
I was using SplashScreenUntilFirstFrame meta tag, Removing it from my main/AndroidManifest.xml works absolutely fine now.

<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true"/>
Reply

#4
2nd answer worked fine if we remove **@NotNull** like

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

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

#5
Add the following line to the dependencies in your app level `build.gradle` file:

dependencies{
api "androidx.core:core:1.1.0-aplha03"
}
Reply

#6
Flutter details

Flutter version 1.22.4 at /Users/macbookpro/Desktop/development/flutter

- Framework revision 1aafb3a8b9 (4 weeks ago), 2020-11-13 09:59:28 -0800
- Engine revision 2c956a31c0
- Dart version 2.10.4
- local_auth: ^0.6.3+4


If you are using java then change your main activity to this

import androidx.annotation.NonNull;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.android.FlutterFragmentActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterFragmentActivity{
}
Reply

#7
In my case, i forgot to change in AndroidManifest.xml file.
Complete changes for reference

MainActivity.java

import android.os.Bundle;
import io.flutter.app.FlutterFragmentActivity;
import io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin;
import io.flutter.plugins.localauth.LocalAuthPlugin;

public class MainActivity extends FlutterFragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FlutterAndroidLifecyclePlugin.registerWith(
registrarFor(
"io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin"));
LocalAuthPlugin.registerWith(registrarFor("io.flutter.plugins.localauth.LocalAuthPlugin"));
}
}

Then

AndroidManifest.xml

From

<application
android:label="<name>"
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
....

To

<application
android:label="<name>"
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterFragmentActivity"
....

Reply

#8
This is what I did to solve this issue.

Change your `MainActivity.kt` as below:
```
package com.[your.package]

import androidx.annotation.NonNull
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)
}
}
```
However, after changing this `MainActivity.kt`, I also faced some other issue with the `Theme.AppCompat`. Check this out for the solution.
Reply

#9
I tried adding the code in MainActivity.kt. For some reason, it doesn't take the code from MainActivity.kt and only searches for MainActivity.java. So the following code in MainActivity.java fixed the issue for me.

MainActivity.java

package com.<package_name>;

import android.os.Bundle;
import io.flutter.embedding.android.FlutterFragmentActivity;
import androidx.annotation.NonNull;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin;
import io.flutter.plugins.localauth.LocalAuthPlugin;

public class MainActivity extends FlutterFragmentActivity {

public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine)
{
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
Reply

#10
From the docs -https://pub.dev/documentation/local_auth/latest/

Simply use the code below in your MainActivity.kt



package [package ID here]

import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity: FlutterFragmentActivity() {
}

Uninstall your current build of the app and then rebuild again

By the way, ensure you're not making multiple calls for



auth.authenticate(...)

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through