APEALED
APEALED

Reputation: 1663

Unable to add an Android asset in Android Studio. Where did the option go?

Context

I am working on a Flutter application and have done all my development in VS Code (my preferred editor). I'm at a point where I need to add vector assets to my project.

Problem

I navigate to the folder in Android Studio my_app/android/app/src/main/res/ or my_app/android/app/src/main/res/drawable and then right-click. I look for the option in the context menu: New > Vector Asset, but it's not there (see image below). This happens at both of the said paths.

What I've tried

My Questions

  1. Where did the option go?

  2. How do I add a vector asset with having to downgrade Android Studio versions?

No New > Vector Asset here

Upvotes: 3

Views: 2946

Answers (3)

Koodimetsa
Koodimetsa

Reputation: 880

Open resource manager from Tools: enter image description here

From there press Import Drawables

enter image description here

Now you can select a svg file you want to import and name it etc.

Upvotes: 0

Mayur Misal
Mayur Misal

Reputation: 846

Given link is show you, how to add vector asset in android studio.

https://developer.android.com/studio/write/vector-asset-studio

  1. You need to add setting in build.gradle (app) file.

    android {

    defaultConfig { vectorDrawables.useSupportLibrary = true

    }

    }

    dependencies {

    compile 'com.android.support:appcompat-v7:23.2.0'
    

    }

  2. steps to add vector asset in res folder: In Android Studio, open an Android app project. In the Project window, select the Android view. Right-click the res folder and select New > Vector Asset. Some other project views and folders have this menu item as well. If a Need Newer Android Plugin for Gradle dialog appears instead, correct your Gradle version as follows: Select File > Project Structure. In the Project Structure dialog, select Project. In the Android Plugin Version field, change the Android Plugin for Gradle version to 1.5.0 or higher, and click OK. Gradle syncs the project. In the Android view of the Project window, right-click the res folder and select New > Vector Asset. Vector Asset Studio appears.

Upvotes: 0

cactustictacs
cactustictacs

Reputation: 19554

They spruced it up, you use the Resource Manager now - if the tab isn't on the top left of the screen then it's in the Tools menu. Once that's open, press the + icon in the top left and you can add a Vector Asset. You can import one, or there's a Clip Art option with built-in icons you can choose from.

edit- that might actually be what you're talking about, and I have the New > Vector Asset option if I right click drawable or res, in both the Android and Project views. Maybe try a Clean and Rebuild in the Build menu, or Invalidate caches/restart in File to give it a kick

Upvotes: 3

Related Questions