admin管理员组

文章数量:1435271

I was trying to generate a thumbnail for a video. The video is from a link on the Internet. Here's the code I'm using to generate the thumbnail:

import coil.ImageLoader
import coil3.video.VideoFrameDecoder

val videoEnabledLoader =
    ImageLoader.Builder(context)ponents {
        add(VideoFrameDecoder.Factory())
    }.build()

But it gives me this error:

None of the following functions can be called with the arguments supplied.

It specifically points on the add function

Here's the dependencies I am using:

implementation("io.coil-kt:coil-compose:2.5.0")
implementation("io.coil-kt.coil3:coil-video:3.0.3")

I was trying to generate a thumbnail for a video. The video is from a link on the Internet. Here's the code I'm using to generate the thumbnail:

import coil.ImageLoader
import coil3.video.VideoFrameDecoder

val videoEnabledLoader =
    ImageLoader.Builder(context)ponents {
        add(VideoFrameDecoder.Factory())
    }.build()

But it gives me this error:

None of the following functions can be called with the arguments supplied.

It specifically points on the add function

Here's the dependencies I am using:

implementation("io.coil-kt:coil-compose:2.5.0")
implementation("io.coil-kt.coil3:coil-video:3.0.3")
Share Improve this question edited Nov 18, 2024 at 18:29 tyg 16.9k4 gold badges40 silver badges49 bronze badges asked Nov 16, 2024 at 16:41 Ernest Muhumuza Ernest Muhumuza 275 bronze badges 1
  • Just to rule out the obvious, did you invalidate caches in Android Studio and did a clean rebuild? – tyg Commented Nov 18, 2024 at 16:04
Add a comment  | 

1 Answer 1

Reset to default 1

You are mixing incompatible Coil versions.

For the ImageLoader.Builder you use Coil 2.5.0, for the VideoFrameDecoder.Factory you use 3.0.3. The reason for the compile error is that the add function requires a

coil.decode.Decoder.Factory

but you provide a

coil3.decode.Decoder.Factory

That doesn't work.

You need to fix your gradle dependencies to use the same version for all Coil artifacts. Either downgrade to 2.5.0:

implementation("io.coil-kt:coil-compose:2.5.0")
implementation("io.coil-kt:coil-video:2.5.0")

and use

import coil.ImageLoader
import coil.decode.VideoFrameDecoder

or upgrade to 3.0.3:

implementation("io.coil-kt.coil3:coil-compose:3.0.3")
implementation("io.coil-kt.coil3:coil-video:3.0.3")

and use

import coil3.ImageLoader
import coil3.video.VideoFrameDecoder

You should probably use a variable for the Coil version and use it in the gradle dependency to mitigate the risk of version mismatches in the future, or - better yet - migrate to version catalogs.

本文标签: androidError Loading a thumbnail for a video using Coil jetpack compose kotlinStack Overflow