Bug P2
Status Update
Comments
al...@gmail.com <al...@gmail.com> #2
Can you attach / share a project that reproduces the issue?
al...@gmail.com <al...@gmail.com> #3
Now i sure this is viewpager2's bug.
because just occur recyclerview inside viewpager2 with constraintlayout, if paging3 use Independently with viewpage2 it's not problem.
because just occur recyclerview inside viewpager2 with constraintlayout, if paging3 use Independently with viewpage2 it's not problem.
ki...@google.com <ki...@google.com>
al...@gmail.com <al...@gmail.com> #5
deleted
al...@gmail.com <al...@gmail.com> #7
al...@gmail.com <al...@gmail.com> #8
I confirmed that it is an issue in Compose as well:
ch...@google.com <ch...@google.com> #9
I'm facing the same bug! I can reproduce it with this vector
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="15"
android:viewportHeight="15"
android:width="15dp"
android:height="15dp">
<path
android:pathData="M15 7.5a7.5 7.5 0 11 -15 0 7.5 7.5 0 0115 0zm-3.9 0L5.55 11V4l5.55 3.5z"
android:fillType="evenOdd"
android:fillColor="#FFFFFF" />
</vector>
al...@gmail.com <al...@gmail.com> #10
This is still an issue in the current framework path parser, the android x path parser, and the compose path parser.
Description
<!-- res/drawable/vd_buggy_elliptical_arc.xml -->
<vector xmlns:android="
android:width="200dp"
android:height="200dp"
android:viewportWidth="200"
android:viewportHeight="200">
<path
android:fillColor="#000000"
android:pathData="M 25 100 a 75 75 0 10150 0 a 75 75 0 10-150 0" />
</vector>
The crash results in the following stack trace:
Caused by: java.lang.IllegalArgumentException: a needs to be followed by a multiple of 7 floats. However, 5 float(s) are found. Failure occurred at position 9 of path: M 25 100 a 75 75 0 10150 0 a 75 75 0 10-150 0
at android.util.PathParser.nCreatePathDataFromString(Native Method)
at android.util.PathParser.access$200(PathParser.java:25)
at android.util.PathParser$PathData.<init>(PathParser.java:78)
at android.graphics.drawable.VectorDrawable$VFullPath.updateStateFromTypedArray(VectorDrawable.java:2039)
at android.graphics.drawable.VectorDrawable$VFullPath.inflate(VectorDrawable.java:1990)
at android.graphics.drawable.VectorDrawable.inflateChildElements(VectorDrawable.java:836)
at android.graphics.drawable.VectorDrawable.inflate(VectorDrawable.java:734)
at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:144)
at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1402)
at android.graphics.drawable.Drawable.createFromXmlForDensity(Drawable.java:1361)
at android.content.res.ResourcesImpl.loadXmlDrawable(ResourcesImpl.java:939)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:862)
The issue is specific to the way Android currently parses elliptical arc SVG path commands. The two elliptical arc commands below illustrate the difference (according to the SVG path data spec both of these strings are valid,
M 25 100 a 75 75 0 1 0 150 0 a 75 75 0 1 0 -150 0 (works fine)
M 25 100 a 75 75 0 10150 0 a 75 75 0 10-150 0 (app crashes)
Note that the difference between these two strings is that the second string is omitting the optional spaces before/after the "large-arc-flag" and "sweep-flag" coordinates (i.e. "a 75 75 0 1 0 150 0" becomes "a 75 75 0 10150 0"). Android's PathParser is not recognizing this case, and is incorrectly interpreting the elliptical arcs in the second string as having "5 floats" when in reality it actually does contain "7 floats". The fact that elliptical arcs don't require spaces between these flags is not being covered in the source code here:
This issue occurs with both the framework VectorDrawable class and the Android X VectorDrawableCompat class. The Android Studio SVG-to-VectorDrawable converter also fails to parse SVGs that use this optimized elliptical arc syntax.
Also note that Chrome renders the second path data string correctly when used in the SVG below (see attachment):
<svg xmlns="
<path d="M 25 100 a 75 75 0 10150 0 a 75 75 0 10-150 0" fill="#000"/>
</svg>
One last note. The reason I discovered this bug is because SVGO was recently updated to optimize elliptical arcs by removing these unnecessary spaces from the string, so I expect it will become more of an issue as more and more people begin to use newer versions of SVGO to optimize their SVGs. Here is the SVGO commit that made the change last July:
I've attached a sample project below that replicates the crash. The sample project is using `implementation 'androidx.vectordrawable:vectordrawable:1.1.0'` in its build.gradle file.