AngeloAvv / flutter_flavorizr

A flutter utility to easily create flavors in your flutter application
https://pub.dev/packages/flutter_flavorizr
MIT License
468 stars 85 forks source link

PathNotFoundException: Cannot open file, path = '.idea/runConfigurations/main_dev_dart.xml' (OS Error: No such file or directory, errno = 2) #209

Closed tajjacob closed 9 months ago

tajjacob commented 1 year ago

Error when running "flutter pub run flutter_flavorizr" causing cannot run on ios.

Can run on android but the icon is not changing.

flutter pub run flutter_flavorizr
Deprecated. Use `dart run` instead.

The errors:

Running FileProcessor: writing file .idea/runConfigurations/main_dev_dart.xml with nested IdeaLaunchProcessor
Unhandled exception:
PathNotFoundException: Cannot open file, path = '.idea/runConfigurations/main_dev_dart.xml' (OS Error: No such file or directory, errno = 2)
#0      _File.throwIfError (dart:io/file_impl.dart:675:7)
#1      _File.openSync (dart:io/file_impl.dart:490:5)
#2      _File.writeAsBytesSync (dart:io/file_impl.dart:644:31)
#3      _File.writeAsStringSync (dart:io/file_impl.dart:668:5)
#4      AbstractFileStringProcessor.execute (package:flutter_flavorizr/src/processors/commons/abstract_file_string_processor.dart:42:10)
#5      QueueProcessor.execute (package:flutter_flavorizr/src/processors/commons/queue_processor.dart:44:17)
#6      QueueProcessor.execute (package:flutter_flavorizr/src/processors/commons/queue_processor.dart:44:17)
#7      IDEProcessor.execute (package:flutter_flavorizr/src/processors/ide/ide_processor.dart:18:17)
#8      Processor.execute (package:flutter_flavorizr/src/processors/processor.dart:139:24)
<asynchronous suspension>

Error when running ios

[!] There may only be up to 1 unique SWIFT_VERSION per target. Found target(s) with multiple Swift versions:
ImageNotification: Swift 
ImageNotification: Swift 5.0

Here is my flavorizr.yaml

app:
  android:
    flavorDimensions: "flavor-type"

flavors:
  dev:
    app:
      name: "myapp Dev"

    android:
      applicationId: "com.myapp.superapp.dev"
      icon: "assets/logo/myapp_dev.png"
      firebase:
        config: "assets/firebase/dev/google-services.json"
    ios:
      bundleId: "com.myapp.superapp.dev"
      icon: "assets/logo/myapp_dev.png"
      firebase:
        config: "assets/firebase/dev/GoogleService-Info.plist"

  stg:
    app:
      name: "myapp Stg"

    android:
      applicationId: "com.myapp.superapp.stg"
      icon: "assets/logo/myapp_stg.png"
      firebase:
        config: "assets/firebase/stg/google-services.json"
    ios:
      bundleId: "com.myapp.superapp.stg"
      icon: "assets/logo/myapp_stg.png"
      firebase:
        config: "assets/firebase/stg/GoogleService-Info.plist"

ide: idea
AngeloAvv commented 1 year ago

Hey @tajjacob can you please take a look here to see if this fixes the issue?

HussainTaj-W commented 1 year ago

For me, the cause was that I have .idea/ in my .gitignore and the directory didn't exist on my Mac.

I suspect many will have the same rules for git. The generated run configurations won't be committed with the default .gitignore rules.

My .gitignore file looks like this now.

.idea/*
!.idea/runConfigurations/
Fintasys commented 10 months ago

I had the same issue, but the PR mentioned above solved it 👍

  flutter_flavorizr:
    git:
      url: https://github.com/AngeloAvv/flutter_flavorizr.git
      ref: fixes/path_not_found_configuration