fluttercommunity / flutter_launcher_icons

Flutter Launcher Icons - A package which simplifies the task of updating your Flutter app's launcher icon. Fully flexible, allowing you to choose what platform you wish to update the launcher icon for and if you want, the option to keep your old launcher icon in case you want to revert back sometime in the future. Maintainer: @MarkOSullivan94

Home Page:https://pub.dev/packages/flutter_launcher_icons

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Using `dart run flutter_launcher_icons` destroys ios-project

ManuelRauber opened this issue · comments

ℹ️ Info

Version: 0.13.1
Flutter: 3.10.5

💬 Description

I've set up my project according to the documentation with flavors.
Then I run dart run flutter_launcher_icon and afterwards I can not compile for iOS anymore due to:

Exception: Unable to get Xcode project information:
 2023-07-24 14:45:45.646 xcodebuild[68258:3775469] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
2023-07-24 14:45:45.676 xcodebuild[68258:3775469] Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0., NSJSONSerializationErrorIndex=0}
2023-07-24 14:45:45.678 xcodebuild[68258:3775469] Writing error result bundle to /var/folders/mk/cp22zm5j4h5d8cj5yc0qtnm80000gn/T/ResultBundle_2023-24-07_14-45-0045.xcresult
xcodebuild: error: Unable to read project 'Runner.xcodeproj'.
	Reason: The project ‘Runner’ is damaged and cannot be opened due to a parse error. Examine the project file for invalid edits or unresolved source control conflicts.

In the diff I can see:

image

As you can see at the bottom, there is this

roject object */;
}

inserted. I don't know, where it comes from. But it comes reliably everytime I run the command.

📜 Pubspec.yaml

name: app_mobile
description: Mobile App
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# Final version will be in the format: 1.0.0+1.
# The +1 is the build number determined by CI.
# For Android it will be used as versionName and for iOS as CFBundleVersion.
version: 2.0.0

environment:
  sdk: '>=3.0.5 <4.0.0'

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter

  go_router: ^9.0.3
  bloc: ^8.1.2
  flutter_bloc: ^8.1.3
  hydrated_bloc: ^9.1.2
  font_awesome_flutter: ^10.5.0

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  widgetbook_annotation: ^3.0.0
  widgetbook: ^3.1.0
  path_provider: ^2.0.15
  logger: ^1.4.0
  path: ^1.8.3
  equatable: ^2.0.5
  flutter_appauth: ^6.0.0
  json_annotation: ^4.8.1
  flutter_secure_file_storage: ^1.0.0
  flutter_secure_storage: ^8.0.0
  flutter_key_value_file_storage: ^0.0.7
  flutter_localizations:
    sdk: flutter
  app_settings: ^5.0.0
  intl: ^0.18.0
  flutter_native_splash: ^2.3.1

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.0
  commitlint_cli: ^0.4.1
  husky: ^0.1.6
  lint_staged: ^0.3.0
  go_router_builder: ^2.2.1
  build_runner: ^2.4.6
  build_verify: ^3.1.0
  test: ^1.24.1
  widgetbook_generator: ^3.0.0
  json_serializable: ^6.7.1
  flutter_launcher_icons: ^0.13.1

dependency_overrides:
  font_awesome_flutter:
    path: vendor/font_awesome_flutter/font_awesome_flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  assets:
    - assets/generated/i18n/da-DK.json
    - assets/generated/i18n/de-DE.json
    - assets/generated/i18n/en-US.json
    - assets/generated/i18n/fi-FI.json
    - assets/generated/i18n/kl-GL.json
    - assets/generated/i18n/nb-NO.json
    - assets/generated/i18n/sv-SE.json

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

lint_staged:
  'lib/**.dart': dart format --fix && dart fix --apply

Yaml-Files for the flavors:

# flutter_launcher_icons-development.yaml
flutter_launcher_icons:
  android: true
  ios: true
  image_path: assets/icons/app-icon-dev.png
  remove_alpha_ios: true

# flutter_launcher_icons-production.yaml
flutter_launcher_icons:
  android: true
  ios: true
  image_path: assets/icons/app-icon.png
  remove_alpha_ios: true
commented

I have this same problem. It doesn't respect flavors either

Screenshot 2024-01-30 at 5 05 49 PM
Screenshot 2024-01-30 at 5 06 55 PM

Reverting these changes works, but it makes automation difficult

I still have this problem, I try to use it with the flavor setup, but it directly breaks the ios build.

Update :

I fixed it with the following :

#491 (comment)

Before I did the procedure in this link, I rollback the changes in the 'project.pbxproj' file. In this way, I first solved the corruption problem of the iOS build.

Then I updated the app icons one by one as in this link. It worked.