Android Question android:pathData Error parsing manifest script CreateResource

Brandsum

Well-Known Member
Licensed User
I'm trying to create a drawable resource. Here is my code:

Code: Copy
CreateResource(drawable, custom_back_material.xml,
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0"
        android:autoMirrored="true"
        android:tint="?attr/colorControlNormal">
    <path
            android:pathData="M20,11L7.8,11l5.6,-5.6L12,4l-8,8l8,8l1.4,-1.4L7.8,13L20,13L20,11z"
            android:fillColor="@color/colorControlNormal"/>
</vector>
)

When compiling the app I'm getting an error: Error parsing manifest script

But when I remove commas from pathData it shows no error.
So commas are causing error.

Is there any workaround to add commas inside CreateResource?
 
Comma is a special character in the manifest editor. You need to escape commas. Like this:
Code: Copy
CreateResource(drawable, custom_back_material.xml,
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0"
        android:autoMirrored="true"
        android:tint="?attr/colorControlNormal">
    <path
            android:pathData="M20,,11L7.8,,11l5.6,,-5.6L12,,4l-8,,8l8,,8l1.4,,-1.4L7.8,,13L20,,13L20,,11z"
            android:fillColor="@color/colorControlNormal"/>
</vector>
)
 
Upvote 0
Back
Top