Reputation: 175
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:
Upvotes: 16
Views: 13365
Reputation: 177
It was not working for me as well, I cleared the build using
flutter clean
and the option was available after that.
Upvotes: 0
Reputation: 231
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.
Upvotes: 23
Reputation: 1470
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!
Upvotes: -2
Reputation: 426
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.
Upvotes: 2
Reputation: 51
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
Upvotes: 5
Reputation: 286
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
Upvotes: 1