coil-kt / coil

Image loading for Android and Compose Multiplatform.
https://coil-kt.github.io/coil/
Apache License 2.0
10.69k stars 648 forks source link

coil3 loading long image will be crash #2300

Closed 1006245347 closed 3 months ago

1006245347 commented 3 months ago

Describe the bug coil3 loading long image will be crash,

Box{ //Column {//超长图在外面套一层column不会崩溃 // SubcomposeAsyncImage( // model = ImageRequest.Builder(LocalPlatformContext.current) // .data(url).build(), // contentDescription = null, // modifier = Modifier.padding(1.dp) // ) { // if (painter.state is AsyncImagePainter.State.Loading || // painter.state is AsyncImagePainter.State.Error // ) { // CircularProgressIndicator() // } else { // SubcomposeAsyncImageContent() // } // } // } }

will be crash Box() {//超长图不在外面套一层会崩溃 SubcomposeAsyncImage( model = ImageRequest.Builder(LocalPlatformContext.current) .data(url).build(), contentDescription = null, modifier = Modifier.padding(1.dp) ) { if (painter.state is AsyncImagePainter.State.Loading || painter.state is AsyncImagePainter.State.Error ) { CircularProgressIndicator() } else { SubcomposeAsyncImageContent() } } }

To Reproduce https://ark-cdn.gree.com/ark/1f42e33985d6c348aca8191679b94ecc9848_1671058244501.jpg?sign=920e0211e4b48c0d32a3d4a117fbbb94&t=1717398000

but it could show 2 hours....

image

Version [What library version are you using? Does this occur on a specific API level or Android device?](io.coil-kt.coil3:coil-compose) io.coil-kt.coil3:coil-compose coil3 = "3.0.0-alpha06"

colinrtwhite commented 3 months ago

What is the exception?

colinrtwhite commented 3 months ago

It looks like your image is 26k pixels and the containing Box has an unbounded height. 26k pixels is larger than the max size Android can support. You need to set a size on your ImageRequest or bound the Box's height.

FooIbar commented 3 months ago

Might be related to #2211, you could try allowHardware(false).