I have an app in flutter and it was working fine on both android and iOS emulators, But after I installed a package( https://pub.dev/packages/flutter_email_sender ), I cannot run my app anymore. I deleted the package and it still gives me errors. I used flutter create. command as well to repair my files and everything is fine but I cannot run my app. The errors I get are:
iOS: *** First throw call stack: ( 0 CoreFoundation 0x000000010f7fcbde __exceptionPreprocess + 350 1 libobjc.A.dylib 0x000000010f66ab20 objc_exception_throw + 48 2 CoreFoundation 0x000000010f7fc958 +[NSException raise:format:arguments:] + 88 3 Foundation 0x000000010f0946f5 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191 4 Flutter 0x000000010cf0dcc9 -[FlutterEngine registrarForPlugin:] + 282 5 Runner 0x000000010ce51b4f +[GeneratedPluginRegistrant registerWithRegistry:] + 271 6 Runner 0x000000010ce51c53 $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 179 7 Runner <…>
Android: /Users/mrp490/Desktop/myFirtstFlutter/find_new_friends/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:6: error: a type with the same simple name is already defined by the single-type-import of KeyboardVisibilityPlugin import com.github.adee42.keyboardvisibility.KeyboardVisibilityPlugin; ^ 1 error
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 27sGradle task assembleDebug failed with exit code 1
this is the android file that is mentioned in the error message:
package io.flutter.plugins;
import io.flutter.plugin.common.PluginRegistry;
import com.flutter.keyboardvisibility.KeyboardVisibilityPlugin;
import io.flutter.plugins.imagepicker.ImagePickerPlugin;
import com.github.adee42.keyboardvisibility.KeyboardVisibilityPlugin;
/**
* Generated file. Do not edit.
*/
public final class GeneratedPluginRegistrant {
public static void registerWith(PluginRegistry registry) {
if (alreadyRegisteredWith(registry)) {
return;
}
KeyboardVisibilityPlugin.registerWith(registry.registrarFor("com.flutter.keyboardvisibility.KeyboardVisibilityPlugin"));
ImagePickerPlugin.registerWith(registry.registrarFor("io.flutter.plugins.imagepicker.ImagePickerPlugin"));
KeyboardVisibilityPlugin.registerWith(registry.registrarFor("com.github.adee42.keyboardvisibility.KeyboardVisibilityPlugin"));
}
private static boolean alreadyRegisteredWith(PluginRegistry registry) {
final String key = GeneratedPluginRegistrant.class.getCanonicalName();
if (registry.hasPlugin(key)) {
return true;
}
registry.registrarFor(key);
return false;
}
}
I also cannot use the debug button as it gives me an error that
"Cannot find a class with the main method", but I can run it in terminal.
Can someone gives me a suggestion to solve this issue.
Thanks.
The problem was one of the third party packages I installed
search_widget: ^0.2.0 The app works without it. I opened an issue on Github if you want to follow.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.