Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Non-SDK usage causing RichPathView.setVectorDrawable to throw an exception when targeting API Level 31 #76

@tomdug

Description

@tomdug

With the release of Android 12, a bunch of non-SDK interfaces were removed (see this).

And this library uses reflection to call this non-SDK method with is now blocked in Android 12:
Landroid/util/PathParser;->createPathFromPathData(Ljava/lang/String;)Landroid/graphics/Path;

Trying to call RichPathView.setVectorDrawable thus causes this exception to be thrown:

W/ Accessing hidden method Landroid/util/PathParser;->createPathFromPathData(Ljava/lang/String;)Landroid/graphics/Path; (max-target-r, reflection, denied)
W/System.err: java.lang.NoSuchMethodException: android.util.PathParser.createPathFromPathData [class java.lang.String]
        at java.lang.Class.getMethod(Class.java:2103)
        at java.lang.Class.getDeclaredMethod(Class.java:2081)
        at com.richpath.pathparser.PathParserCompatApi21.getCreatePathFromPathDataMethod(PathParserCompatApi21.java:37)
        at com.richpath.pathparser.PathParserCompatApi21.createPathFromPathData(PathParserCompatApi21.java:21)
        at com.richpath.pathparser.PathParser.createPathFromPathData(PathParser.java:18)
        at com.richpath.RichPath.<init>(RichPath.java:71)
        at com.richpath.util.XmlParser.parsePathElement(XmlParser.java:87)
        at com.richpath.util.XmlParser.parseVector(XmlParser.java:55)
        at com.richpath.RichPathView.setVectorDrawable(RichPathView.java:84)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions