Skip to content

showing error No file or variants found for asset: loadjson/person.json. #17283

Closed

Description

@sovoereign
name: jsondata
description: A new Flutter application.

dependencies:
  flutter:
    sdk: flutter
    cupertino_icons: ^0.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter
 
flutter:
  assets:
     - loadjson/person.json
  uses-material-design: true

Activity

  1. zoechi commented on May 8, 2018

    @zoechi
    Contributor

    What action causes this error?
    Please add the output of flutter doctor?

  2. pdichone commented on May 30, 2018

    @pdichone

    I am getting the same error now too. Any solution for this?

         - images/light_rain.png
         - images/umbrella.png
         - images/white_snow.png 
    
    
    That's on my pubspec.yaml, but I get the error:
    
    
      Error detected in pubspec.yaml:
    No file or variants found for asset: images/umbrella.png. 
    
    Not sure what's going on.
    
  3. tobyokeke commented on Jun 13, 2018

    @tobyokeke

    Im getting this as well and there are files in the right place and i'm using
    -assets/images/

  4. zoechi commented on Jun 13, 2018

    @zoechi
    Contributor

    @tobyokeke Currently all files need to be listed individually.
    The new feature to resolve a directory entry to its containing files is available in master but not yet in beta: https://github.com/flutter/flutter/pull/16413/files

    I think you need a space after - https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html

  5. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 13, 2018
  6. tobyokeke commented on Jun 13, 2018

    @tobyokeke

    Thank you. Individual listing worked.

  7. no-response commented on Aug 19, 2018

    @no-response

    Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
    Thanks for your contribution.
    cc @Hixie

  8. austenstrine commented on Aug 16, 2019

    @austenstrine

    I also encountered this, in my case it was I think more user error than anything else. I placed my image folder in the lib folder, so I needed to put lib/ in front of the path. Worth checking for anyone who comes across this bug report.

  9. abuzarsaddiqui commented on Sep 11, 2019

    @abuzarsaddiqui

    If this is the scenario:
    assets -> images -> pic.png
    then define your asset like this
    assets:
    - assets/images/pic.png

  10. egidiocs commented on Oct 27, 2019

    @egidiocs

    If this is the scenario:
    assets -> images -> pic.png
    then define your asset like this
    assets:

    • assets/images/pic.png

    this is correct, for Android! The documentation: https://flutter.dev/docs/development/ui/assets-and-images#android

    for iOS refer to: https://flutter.dev/docs/development/ui/assets-and-images#ios

  11. SOURAVTIWARI01 commented on Jan 2, 2020

    @SOURAVTIWARI01

    Hi All,

    i got the same error but later i realized that i m making the image( or asset) folder inside the lib folder. but that has to be made outside the lib folder.
    please check the image below for reference. Hope it helps :-)
    error image

  12. pahoel commented on Feb 26, 2020

    @pahoel

    Pubspec.yaml:
    assets:
    - assets/sounds/alarm.mp3
    - images/a_dot_ham.jpeg

    main.dart:
    int soundId = await rootBundle.load("assets/sounds/alarm.mp3")......

  13. sk67dev commented on Mar 23, 2020

    @sk67dev

    Hi, I had the same problem where the image wouldn't appear and have managed to get it to work by:

    1. Moving assets back by 1 character in Pubspec.yaml,
    2. Creating the assets directory outside the lib folder and
    3. removing images / and adding just the image:
      assets:
      - gym_logo.png
  14. 1 remaining item

  15. ihongx commented on May 24, 2020

    @ihongx

    Just rename the file name then it works.

  16. sunaarun commented on Sep 30, 2020

    @sunaarun

    I was facing the same problem , and I had two mistakes:
    1- I created the "images" folder inside the "lib" folder , and it should be outside the lib folder , it should be in the app root folder.
    image

    It should be spaces from the starter line , and should appear a grey line , like this
    image

    Hope it helps you

  17. swatkat1127 commented on Oct 23, 2020

    @swatkat1127

    Hi All,

    i got the same error but later i realized that i m making the image( or asset) folder inside the lib folder. but that has to be made outside the lib folder.
    please check the image below for reference. Hope it helps :-)
    error image

  18. swatkat1127 commented on Oct 23, 2020

    @swatkat1127

    Thanks..It helped

  19. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Dec 2, 2020
  20. harisdin commented on Jan 25, 2021

    @harisdin

    Hi, I had the same problem where the image wouldn't appear and have managed to get it to work by:

    1. Moving assets back by 1 character in Pubspec.yaml,
    2. Creating the assets directory outside the lib folder and
    3. removing images / and adding just the image:
      assets:
      - gym_logo.png

    it work for me

  21. Taoufik32 commented on May 20, 2021

    @Taoufik32

    Thanks

  22. maitisoumyajit commented on Jul 9, 2021

    @maitisoumyajit

    I was facing the same problem , and I had two mistakes:
    1- I created the "images" folder inside the "lib" folder , and it should be outside the lib folder , it should be in the app root folder.
    image

    It should be spaces from the starter line , and should appear a grey line , like this
    image

    Hope it helps you

    Bro, I tried... It did not work. After tried all solutions given above.... the error did not resolves
    FlutterError1

  23. sunaarun commented on Jul 14, 2021

    @sunaarun

    I was facing the same problem , and I had two mistakes:
    1- I created the "images" folder inside the "lib" folder , and it should be outside the lib folder , it should be in the app root folder.
    image
    It should be spaces from the starter line , and should appear a grey line , like this
    image
    Hope it helps you

    Bro, I tried... It did not work. After tried all solutions given above.... the error did not resolves
    FlutterError1

    try to add another space

  24. SOURAVTIWARI01 commented on Jul 14, 2021

    @SOURAVTIWARI01

    @sunaarun How can we connect bro ?
    Lets screen share and see your issue

  25. maitisoumyajit commented on Jul 15, 2021

    @maitisoumyajit
  26. sunaarun commented on Jul 18, 2021

    @sunaarun

    @sunaarun How can we connect bro ?
    Lets screen share and see your issue

    @SOURAVTIWARI01 is the problem still there

  27. maitisoumyajit commented on Jul 22, 2021

    @maitisoumyajit
  28. github-actions commented on Aug 5, 2021

    @github-actions

    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.

  29. locked as resolved and limited conversation to collaborators on Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions