vector-compat
vector-compat copied to clipboard
res/drawable/ic_drawer_vector.xml has error in parsing during build
This is in android studio 15: build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.foo.bar"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.wnafee:vector-compat:1.0.5'
}
offending file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:width="48dp"
android:height="48dp"
android:viewportWidth="24"
android:viewportHeight="24"
app:vc_viewportWidth="24"
app:vc_viewportHeight="24" >
<group
android:name="rotationGroup"
android:pivotX="12.0"
android:pivotY="12.0"
android:rotation="0.0">
<path
android:name="v"
android:fillColor="#000000"
android:pathData="@string/path_drawer"
app:vc_fillColor="#000000"
app:vc_pathData="@string/path_drawer"/>
</group>
</vector>
<!-- From: file:/Users/wnafee/code/vector-compat/library/src/main/res/drawable/ic_drawer_vector.xml -->
error:
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources]
Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComWnafeeVectorCompat105Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
E:\AndroidProjects\androapplication\app\build\intermediates\exploded-aar\com.wnafee\vector-compat\1.0.5\res\drawable\ic_drawer_vector.xml: Error: error in parsing "g/"
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> E:\AndroidProjects\androapplication\app\build\intermediates\exploded-aar\com.wnafee\vector-compat\1.0.5\res\drawable\ic_drawer_vector.xml: Error: error in parsing "g/"
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 58.321 secs
A workaround for this issue is to disable the auto PNG rasterizing per densities; add the following statement in your build.gradle:
defaultConfig {
//...
generatedDensities = []
}
After adding:
defaultConfig {
//...
generatedDensities = []
}
I am getting this: android.content.res.Resources$NotFoundException: Resource ID for every Vector resource. Any ideas?
Example line where the exception is happening:
VectorDrawable chevronDrawable = VectorDrawable.getDrawable(getContext(), R.drawable.vect_ic_chevron_right);
vectorDrawables.useSupportLibrary = true
Hi there. :wave:
I'm using Android Studio 2.1.2.
Adding vectorDrawables.useSupportLibrary = true
to the defaultConfig { ... }
section of my build.gradle file seems to alleviate this problem for me. :smile: Something like:
defaultConfig {
//...
vectorDrawables.useSupportLibrary = true
}
Thanks @alkurop for the suggestion. :+1: