Fixed
Status Update
Comments
al...@gmail.com <al...@gmail.com> #2
I attached two SVGs that I believe also exhibit buggy behavior due to this bug. They are more complicated so they might be useful to test with as you fix the bug.
Description
Build #AI-183.2153.8.34.5081642, built on October 19, 2018
JRE: 1.8.0_152-release-1248-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.1
=====================
===== INPUT SVG =====
=====================
The SVG I imported into Android Studio's 'Create Vector Asset' wizard is below (see the svg_input_file.svg attachment).
<svg xmlns="
<defs>
<clipPath id="clip-path">
<path d="M 0 0 h 24 v 24 h -24 v -24 z"/>
</clipPath>
</defs>
<path d="M 2 2 h 20 v 20 h -20 v -20" fill="none" stroke="#000" stroke-width="0.5"/>
<g clip-path="url(#clip-path)">
<path d="M 2 12 h 20" transform="translate(0 -10)" fill="none" stroke="#f00"/>
</g>
</svg>
See the svg_input_file_screenshot.png attachment for a screenshot of how this SVG is rendered in Chrome.
============================
===== PREVIEWED VECTOR =====
============================
The preview of this SVG in Android Studio was incorrect because it was not identical to how it is rendered in Chrome.
See the android_studio_vector_preview.png file for a screenshot of what it looked like in Android Studio.
===========================
===== EXPORTED VECTOR =====
===========================
The exported vector was also not correct:
<vector xmlns:android="
android:height="24dp"
android:width="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path android:pathData="M2,2h20v20h-20v-20"
android:fillColor="#00000000"
android:strokeColor="#000"
android:strokeWidth="0.5"/>
<group>
<clip-path android:pathData="M0,0h24v24h-24v-24z M 0,0"/>
<path android:pathData="M 2 12 h 20"
android:fillColor="#00000000"
android:strokeColor="#f00"
android:strokeWidth="1"/>
</group>
</vector>
See the vector_output_screenshot.png file for a screenshot of what it looked like in a sample app.
=====================================
===== WHAT IS CAUSING THIS BUG? =====
=====================================
I believe the cause of the bug has to do with the following SVG nodes:
<g clip-path="url(#clip-path)">
<path d="M 2 12 h 20" transform="translate(0 -10)" fill="none" stroke="#f00"/>
</g>
Specifically, it seems like the transform attribute on the path is being ignored.
The sample project with the incorrectly exported vector is attached to this bug report.