Invalid redeclaration of 'SwiftEntryPlugin'
Taking Nisanth Reddy's advice from the comment above and grepping for SwiftEntryPlugin: NSObject
my search was narrowed down to 2 files. The files were ./my-app/ios/.symlinks/plugins/entry/ios/Classes/SwiftEntryPlugin.swift
and ./my-app/ios/.symlinks/plugins/entry/ios/Classes/SwiftAnimateInPlugin.swift
. After some trial and error, it seems like both files are required (the redundant one being required by a particular Flutter package I'm using, I think) but both had the exact same code in them so I removed all the code from one of the files but left the empty file sitting there in the directory and the problem was resolved.
Comments
-
Stack Underflow about 1 year
I developed a flutter app on an Ubuntu machine and it works without problems on Android. Now I am trying to run it on iOS from a Mac but when I start debugging, I get several errors like the following:
/opt/flutter/.pub-cache/hosted/pub.dartlang.org/entry-0.0.2_2/ios/Classes/SwiftAnimateInPlugin.swift:4:14: error: invalid redeclaration of 'SwiftEntryPlugin' public class SwiftEntryPlugin: NSObject, Flutter Plugin { ^
flutter doctor
passes for Flutter, Xcode, and Connected device.- Flutter 2.2.0 - channel stable
- Tools - Dart 2.13.0
I have checked this question but they are not using Flutter and the answers are not relevant as far as I can tell. What would cause this error and how might I resolve it?
-
Nisanth Reddy almost 3 yearsThe answer in the link should be the one to be followed. This usually happens because you have duplicate files in your code. Grep for SwiftEntryPlugin: NSObject and check what all files are having that code. one of them should be a duplicate. This need not be particularly related to flutter.
-
Stack Underflow almost 3 years@NisanthReddy I didn't have duplicate files but two files with different names happened to have duplicate code for whatever reason. I had been grepping for
SwiftEntryPlugin
which was returning too many results so your suggestion to grep with the: NSObject
was helpful. -
Nisanth Reddy almost 3 yearswonderful. glad to have helped:)