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

Error: "Failed to create icon" on flutter pub run msix:create command #21

Closed
Abhishek0116 opened this issue Feb 11, 2021 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@Abhishek0116
Copy link

I tried to build my sample application as windows installable file with this package but when I ran the final command flutter pub run msix:create then an error occurred.

I am using msix: ^0.1.12

Here are full error details or output from the terminal

C:\Users\Abhishek Kumar\Development\AndroidStudioProjects\TestProjects\my_test_project>flutter build windows

Building with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Building Windows application...

C:\Users\Abhishek Kumar\Development\AndroidStudioProjects\TestProjects\my_test_project>flutter pub run msix:create
getting config values..  [√]
validate config values..  [√]
cleaning temporary files..  [√]
create icons folder..  [√]
copy icons..  Unhandled exception:
fail to create icon C:/Users/Abhishek%20Kumar/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/msix-0.1.12/lib/assets/icons/icon.png: FileSystemException: Cannot copy file to 'C:\Users\Abhishek Kuma
r\Development\AndroidStudioProjects\TestProjects\my_test_project/build/windows/runner/Release/icons/icon.png', path = 'C:/Users/Abhishek%20Kumar/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/msi
x-0.1.12/lib/assets/icons/icon.png' (OS Error: The system cannot find the file specified.
, errno = 2)
#0      MsixFiles._copyIcon (package:msix/src/msixFiles.dart:271:7)
<asynchronous suspension>
#1      MsixFiles.copyIcons (package:msix/src/msixFiles.dart:38:33)
<asynchronous suspension>
#2      Msix.createMsix (package:msix/msix.dart:25:5)
<asynchronous suspension>
pub finished with exit code 255

C:\Users\Abhishek Kumar\Development\AndroidStudioProjects\TestProjects\my_test_project>
@YehudaKremer
Copy link
Owner

YehudaKremer commented Feb 11, 2021

hello Abhishek

Maybe the problem is file path with a space,
I'm not sure yet.

Please try to setup the 3 icons in your pubspec.yaml like that:

msix_config:
  logo_path: C:\<PathToIcon>\<Logo.png>
  start_menu_icon_path: C:\<PathToIcon>\<Icon.png>
  tile_icon_path: C:\<PathToIcon>\<Icon.png>

with that the problem is still happening?

@Abhishek0116
Copy link
Author

@YehudaKremer Thanks for your reply.

I tried the above solution but now another error occurred

Here's all command I ran

flutter clean && flutter pub get

flutter build windows

flutter pub run msix:create

Here's the full output

C:\Users\Abhishek Kumar\Development\AndroidStudioProjects\TestProjects\beeta_lubricants>flutter clean && flutter pub get
Deleting .dart_tool...                                              18ms
Deleting .packages...                                                3ms
Deleting Generated.xcconfig...                                       2ms
Deleting flutter_export_environment.sh...                            2ms
Deleting ephemeral...                                               15ms
Deleting ephemeral...                                                3ms
Deleting ephemeral...                                                6ms
Deleting .flutter-plugins-dependencies...                            2ms
Deleting .flutter-plugins...                                         3ms
Running "flutter pub get" in beeta_lubricants...                    3.2s

C:\Users\Abhishek Kumar\Development\AndroidStudioProjects\TestProjects\beeta_lubricants>flutter build windows

Building with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Building Windows application...

C:\Users\Abhishek Kumar\Development\AndroidStudioProjects\TestProjects\beeta_lubricants>flutter pub run msix:create
getting config values..  [√]
validate config values..  [√]
cleaning temporary files..  [√]
create icons folder..  [√]
copy icons..  [√]
create manifest file..  [√]
copy VCLibs files..  Unhandled exception:
FileSystemException: Directory listing failed, path = 'C:/Users/Abhishek%20Kumar/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/msix-0.1.12/lib/assets/VCLibs/x64\*' (OS Error: The system cannot
 find the path specified.
, errno = 3)
Instance of '_StringStackTrace'pub finished with exit code 255

C:\Users\Abhishek Kumar\Development\AndroidStudioProjects\TestProjects\beeta_lubricants>

@micross
Copy link

micross commented Feb 21, 2021

the file path comes from the config file .packages which is uri encoded.

@Abhishek0116
Copy link
Author

the file path comes from the config file .packages which is uri encoded.

Hey, @micross thanks for this info.

What do I need to modify from my side? Can you please explain a bit?

@micross
Copy link

micross commented Feb 23, 2021

@Abhishek0116 this line msix/main/lib/src/configuration.dart

add

msixAssetsPath = Uri.decodeFull(msixAssetsPath);

after

msixAssetsPath = packages
            .firstWhere((package) => package.contains('msix:'))
            .replaceAll('msix:', '')
            .replaceAll('file:///', '') +
        'assets';

however, a simple way is to remove the space in Abhishek Kumar.

FYI: the .packages file is deprecated. see Dart Package Configuration File v2.0

@YehudaKremer
Copy link
Owner

@micross Thank you for your inputs!

  • i update the code to use package_config.dart instead of .packages.
  • added Uri.decodeFull

@Abhishek0116 please check if the problem solved in version 0.1.14

@YehudaKremer
Copy link
Owner

Hello @Abhishek0116 Did the fix help you?

@YehudaKremer YehudaKremer added the bug Something isn't working label Mar 3, 2021
@Abhishek0116
Copy link
Author

Thanks, @micross and @YehudaKremer I have fixed my issue with your help and tested my created Windows app successfully. As @YehudaKremer said that issue is fixed in version 0.1.14 and currently I tested successfully with version 0.1.15 so I am closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants