12

I want to create a new icon using the assets tool as described here. Surprisingly, the option to create an image set is missing in the context menu:

Screenshot

aboger
  • 2,214
  • 6
  • 33
  • 47
Davies
  • 135
  • 1
  • 1
  • 7

6 Answers6

21

enter image description here

right-click anywhere on your flutter project > Flutter > Open Android Module in Android Studio.(new window) it's gonna ask you to update Gradle on the bottom right, update it. wait a bit.

once updated, right-click on the res folder and the option should be available.

enter image description here

Nuwan Thisara
  • 226
  • 5
  • 15
  • 2
    Hi Francisco, welcome to SO! You'll want to include images in answers, rather than links, so the answer is still readable years from now. – stevegt May 10 '21 at 18:08
  • 1
    Yep -- my bad. Thought of that a few minutes after it went by in my review queue and didn't get back here quickly enough. ;-) – stevegt May 10 '21 at 18:41
5

Open just the android folder of flutter project in android studio.

Then you can see the image asset studio is available.

Here's a link.

https://github.com/flutter/flutter-intellij/issues/3512

Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
2

You have to create flutter project firstly using Android Studio rather than using VS code. After project was created, you can open it on VS code and start coding... otherwise you won't be able to access android studio modules and some options such as either Vector asset or Image asset . hope you'll get this.

Ben
  • 395
  • 1
  • 5
  • 16
1

prefer Remon Answer for adding images to flutter asset but if you want to achieve that 1-open your android project from flutter in android studio to be able to see the command you have mentioned so you can follow your tutorial

enter image description here

0

It was not working for me as well, I cleared the build using flutter clean and the option was available after that.

-1

to create an Image asset in flutter you need to do the following:

1 - in project view mode, right-click on your root project and choose new directory; and give it a name images

2 - go to pubspec.yaml file and find the assets section. it will be commented so uncomment it then add your directory to the assets. it should look like this:

assets:
  - images/             

be careful with the indentation though. it won't work if your indentation is not correct.

then you can use all the image assets that you add to that directory in your project.

if you need more clarifications, let me know in the comments!

Ujjwal Raijada
  • 867
  • 10
  • 21
Remon Shehatta
  • 1,324
  • 1
  • 10
  • 21
  • 10
    This question is about Image asset studio, but this answer is about adding images to a flutter project. I think those are two different things. – Nuwan Thisara Oct 10 '21 at 09:09