https://kotlinlang.org logo
#compose
Title
# compose
j

joadar

01/14/2022, 3:17 PM
Hey, do I need to add a rule on proguard to enable WEBP with Compose? On debug I have zero crash but on release I do:
Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
Here is my code: (the drawable is a .webp)
Copy code
Image(
        painter = painterResource(R.drawable.bg_video),
        contentDescription = null,
        modifier = Modifier.fillMaxSize()
    )
I get the same issue with Icon and vectorDrawable:
Copy code
Icon(
        painter = painterResource(R.drawable.ic_video),
        contentDescription = null,
        modifier = modifier.padding(20.dp),
        tint = Color.White
    )
R.drawable.ic_video
Copy code
<vector xmlns:android="<http://schemas.android.com/apk/res/android>"
    android:width="20dp"
    android:height="15dp"
    android:viewportWidth="20"
    android:viewportHeight="15">
  <path
      android:pathData="M13.8407,7.7911L7.8407,11.5411C7.7873,11.5745 7.7273,11.5909 7.6667,11.5909C7.6107,11.5909 7.5547,11.5766 7.504,11.5473C7.3987,11.4873 7.3333,11.3734 7.3333,11.25L7.3333,3.75C7.3333,3.6273 7.3987,3.5134 7.504,3.4527C7.6093,3.3927 7.738,3.3948 7.8407,3.4589L13.8407,7.2089C13.9393,7.2709 14,7.3814 14,7.5C14,7.6193 13.9393,7.7291 13.8407,7.7911M17.2487,0.465C16.7433,0.422 16.2527,0.3757 15.766,0.33C13.9713,0.1602 12.2767,0 10,0C7.8007,0 5.956,0.1711 4.1727,0.3368C3.702,0.3805 3.2307,0.4241 2.7513,0.465C1.2087,0.5973 0,1.9398 0,3.523L0,11.4777C0,13.0602 1.2087,14.4034 2.7513,14.535C3.2527,14.578 3.7393,14.6236 4.2233,14.6693C6.0313,14.8391 7.7393,15 10,15C12.3247,15 13.9807,14.8418 15.7353,14.6748C16.2293,14.627 16.7293,14.58 17.2487,14.535C18.792,14.4034 20,13.0602 20,11.4777L20,3.523C20,1.9398 18.792,0.5973 17.2487,0.465"
      android:strokeWidth="1"
      android:fillColor="#FFFFFF"
      android:fillType="evenOdd"
      android:strokeColor="#00000000"/>
</vector>
v

Vsevolod Kaganovych

01/14/2022, 6:07 PM
But you're showing the vector drawable (.svg), not webp.
j

joadar

01/15/2022, 12:10 PM
I am showing the vector drawable as .xml (not .svg) because I got the same issue than .webp 😕
12 Views