RichPath icon indicating copy to clipboard operation
RichPath copied to clipboard

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

Open tomdug opened this issue 4 years ago • 1 comments

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)

tomdug avatar Aug 24 '21 09:08 tomdug

Thank you for reporting this issue, I'd check that this week.

On Tue, Aug 24, 2021, 11:00 AM Tom @.***> wrote:

With the release of Android 12, a bunch of non-SDK interfaces were removed (see this https://developer.android.com/about/versions/12/non-sdk-12#new-blocked).

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.(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)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tarek360/RichPath/issues/76, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBXOWB3IL2Q2JWOOMNE5TLT6NNR3ANCNFSM5CWLZEGQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

tarek360 avatar Aug 24 '21 09:08 tarek360