flutter_fgbg icon indicating copy to clipboard operation
flutter_fgbg copied to clipboard

Wrong version installing on Mac M1

Open dgaedcke opened this issue 3 years ago • 6 comments

This is very strange ... seems a recent issue after I began using --dart-define in my build phase

I have a null safe flutter project, and my build onto IOS keeps failing. Even though my pubspec.yaml specified fgbg "^0.1.0", the podfile.lock indicates that "0.0.1" has been installed.

Build to IOS simulator keeps failing with:
flutter_fgbg not found on this line of the GeneratedPluginRegistrant.m

#if __has_include(<flutter_fgbg/FlutterFGBGPlugin.h>)
#import <flutter_fgbg/FlutterFGBGPlugin.h>
#else
@import flutter_fgbg;
#endif

I'm very confused but I'm going to just point straight to this repo (instead of pub.dev) and see if that changes anything ...

dgaedcke avatar Nov 24 '21 15:11 dgaedcke

Interesting. Could you try flutter_fgbg: 0.1.0 and see if that makes a difference?

ajinasokan avatar Nov 25 '21 04:11 ajinasokan

That IS what was specified in my pubspec ... that's how I found the problem ... it seems the .lock file was preventing an upgrade from 0.0.1

dgaedcke avatar Nov 25 '21 19:11 dgaedcke

Ah alright. I have faced similar issue when changing a commit reference of a git dependency of another lib. It simply wouldn't use the given commit. I had to clean project, delete lock file, change commit to something that does not exist and then back etc. to fix that. I believe this is similar. And this is more like a pub tool or pub's cache problem than a lib issue.

ajinasokan avatar Nov 26 '21 03:11 ajinasokan

Hey @ajinasokan . First let me thank you for this package, it solves so many issues we are having the the vanilla life cycle state listener. Good job man!

About the issue, Im having the same problem. I

  • deleted the Podfile.lock,
  • did flutter pub cache clean
  • and flutter pub get

But still get the 0.0.1 in the Podfile.lock

danielRi avatar Dec 07 '21 12:12 danielRi

@dgaedcke @danielRi Sorry. Something I missed from both of your comments is that you were mentioning Podfile.lock and not pubspec.lock. Some things I would like to share:

  1. You don't have to look at Podfile.lock version numbers. For Flutter plugins pubspec.lock is what matters AFAIK.
  2. Check pubspec.lock and see the version of flutter_fgbg in it. If it is like following then you are on latest version:
  flutter_fgbg:
    dependency: "direct main"
    description:
      name: flutter_fgbg
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.1.0"
  1. Version in Podfile.lock comes from podspec file of the lib. None of my libraries updates that number. Because it doesn't have any significance as Flutter build process always uses the files from the corresponding pub package and not cocoapods.
  2. Most of the official libraries also doesn't use that number. For example in Podfile.lock of one of my projects:
  - orientation (0.0.1):
    - Flutter
  - package_info (0.0.1):
    - Flutter
  - path_provider (0.0.1):
    - Flutter
  - share (0.0.1):
    - Flutter
  - url_launcher (0.0.1):
    - Flutter
  - video_player (0.0.1):
    - Flutter

So could you take a look at pubspec.lock and let me know if that shows 0.1.0? If yes then the build issue seem to be unrelated to the version. I would recommend to see the flutter build -v output to pinpoint the cause.

ajinasokan avatar Dec 08 '21 03:12 ajinasokan

Hi @ajinasokan

you are right, my Podfile.lock actually also contains many 0.0.1 entries. For me, this issue can be closed. Thank you!

danielRi avatar Dec 08 '21 07:12 danielRi