I'm trying to add a Vector Asset (SVG) to my Flutter Android project, but all the directions I'm finding online aren't working.
What I'm reading says there's supposed to be a process from Android Studio that lets me add an asset like:
I also made changes to my gradle.build file. However, I don't seem to have the option to add a Vector Asset and I'm not sure what I'm missing.
gradle.build
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.test"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
vectorDrawables.useSupportLibrary = true
generatedDensities=[]
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
What am I missing or how to import an SVG asset to be a drawable in Android?
Android has to be 5.0+ or higher to support Vector Assets.
An alternative solution is to take vector assets and turn them into a high resolution PNG, and 9 patch the images and create drawable layers (this was for a splash page with XML configuration for the layout).