Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No type or protocol named 'FlutterPlugin' #62102

Closed
casualcoder404 opened this issue Jul 23, 2020 · 11 comments
Closed

No type or protocol named 'FlutterPlugin' #62102

casualcoder404 opened this issue Jul 23, 2020 · 11 comments
Labels
c: crash Stack traces logged to the console platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@casualcoder404
Copy link

casualcoder404 commented Jul 23, 2020

When I try to flutter build ios or just run on iOS simulator, it fails with following error:

Failed to build iOS app
Error output from Xcode build:

** BUILD FAILED **

Xcode's output:

In file included from
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:5:
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.h:7:51: error: no type or protocol named 'FlutterPlugin'
@interface FLTSharedPreferencesPlugin : NSObject
^
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:11:41: error: no type or protocol named 'FlutterPluginRegistrar'
+ (void)registerWithRegistrar:(NSObject *)registrar {
^
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:12:3: error: use of undeclared identifier 'FlutterMethodChannel'
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:CHANNEL_NAME
^
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:12:25: error: use of undeclared identifier 'channel'
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:CHANNEL_NAME
^
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:12:36: error: use of undeclared identifier 'FlutterMethodChannel'
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:CHANNEL_NAME
^
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:14:4: error: use of undeclared identifier 'channel'
[channel setMethodCallHandler:^(FlutterMethodCall *call, FlutterResult result) {
^
6 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

Encountered error while building for device.

And this is how it looks in xcode

Screenshot 2020-07-23 at 11 56 58 AM

[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.4 19E287, locale en-IN)
• Flutter version 1.17.5 at /Users/hh/Developer/flutter
• Framework revision 8af6b2f (3 weeks ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/hh/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.9.1

[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 43.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] Connected device (1 available)
• iPad Pro (12.9-inch) (4th generation) • 7983738B-844D-4B69-98BF-D93F5F3550AB • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)

• No issues found!

Please help.

@darshankawar
Copy link
Member

Hi @casualcoder404,
Can you try this solution and see if it works for you ?
Thanks.

@darshankawar darshankawar added in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Jul 23, 2020
@darshankawar
Copy link
Member

Related to 58594

@casualcoder404
Copy link
Author

casualcoder404 commented Jul 23, 2020

Hi @casualcoder404,
Can you try this solution and see if it works for you ?
Thanks.

Hey @darshankawar thanks for the reply.

I checked that solution but I'm afraid of implementing it as there are many other configurations made to existing project for say implementing firebase and NotificationServiceExtensions etc. Also it is a live app on app store.

Isn't there any way to fix the existing project, please.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 23, 2020
@darshankawar
Copy link
Member

Hi @casualcoder404,
Can you try by upgrading shared_preferences plugin to latest version, run pub get, then do a flutter clean and then flutter run ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 23, 2020
@casualcoder404
Copy link
Author

Hi @casualcoder404,
Can you try by upgrading shared_preferences plugin to latest version, run pub get, then do a flutter clean and then flutter run ?

Yes sir, I tried this but didn't help.

(I tried v 0.5.7+3 and not v 0.5.8 as it is giving some errors, but I don't think that matters)

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 23, 2020
@casualcoder404
Copy link
Author

Screenshot 2020-07-23 at 6 09 16 PM

Screenshot 2020-07-23 at 6 10 00 PM

Here's a screenshot from xcode. I don't think the issue is with any particular package, as the Semantic issue and Generic issue randomly shows up on any one of the packages.

@casualcoder404
Copy link
Author

Appdelegate.m

Screenshot 2020-07-23 at 6 25 22 PM

@darshankawar darshankawar added platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels. c: crash Stack traces logged to the console and removed in triage Presently being triaged by the triage team labels Jul 23, 2020
@jmagman
Copy link
Member

jmagman commented Jul 29, 2020

Those errors mean it can't find the Flutter.framework symbols.
What's the output of:

$ file ios/Flutter/Flutter.framework/Flutter

@jmagman jmagman added this to Awaiting triage in Tools - Xcode review via automation Jul 29, 2020
@jmagman jmagman added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 29, 2020
@casualcoder404
Copy link
Author

Those errors mean it can't find the Flutter.framework symbols.
What's the output of:

$ file ios/Flutter/Flutter.framework/Flutter

$ file ios/Flutter/Flutter.framework/Flutter
ios/Flutter/Flutter.framework/Flutter: Mach-O universal binary with 3 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm_v7] [arm64]
ios/Flutter/Flutter.framework/Flutter (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
ios/Flutter/Flutter.framework/Flutter (for architecture armv7): Mach-O dynamically linked shared library arm_v7
ios/Flutter/Flutter.framework/Flutter (for architecture arm64):

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 31, 2020
@casualcoder404
Copy link
Author

The workaround mentioned by @darshankawar worked. The only problem for me was changing the name to create new project, as it'll change other configurations such as app store id and firebase integration etc. But I was able to create a new project in different folder, with the same name. And copied lib, pubscec and android folder to it with some small changes to xcode and it worked.

Thanks everyone.

Tools - Xcode review automation moved this from Awaiting triage to Engineer reviewed Jul 31, 2020
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: crash Stack traces logged to the console platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels.
Projects
Tools - Xcode review
  
Engineer reviewed
Development

No branches or pull requests

3 participants