skydoves / landscapist

🌻 A pluggable, highly optimized Jetpack Compose and Kotlin Multiplatform image loading library that fetches and displays network images with Glide, Coil, and Fresco.

Home Page:https://skydoves.github.io/landscapist/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

java.lang.NullPointerException

acaliaro opened this issue · comments

Please complete the following information:

  • Library Version com.github.skydoves:landscapist-glide:2.0.1
  • Affected Device(s) Android Studio Preview

Describe the Bug:

I try to have a preview in Android Studio but I have an exception

`
@composable
fun AvatarView(){
GlideImage(
modifier = Modifier
.width(80.dp)
.height(80.dp)
.clip(CircleShape),

      imageOptions = ImageOptions(
          contentScale = ContentScale.Crop,
          alignment = Alignment.Center
      ),

      imageModel ={ "https://avatars.githubusercontent.com/u/27887884?v=4" },
      requestOptions = {
          RequestOptions()
              .override(512, 512)
              .diskCacheStrategy(DiskCacheStrategy.ALL)
              .centerCrop()
      },
      // shows an indicator while loading an image.
      loading = {
          Box(modifier = Modifier.matchParentSize()) {
              CircularProgressIndicator(
                  modifier = Modifier.align(Alignment.Center)
              )
          }
      },
      // shows an error text if fail to load an image.
      failure = {
          Text(text = "image request failed.")
      },
  )

}

@Preview
@composable
fun AvatarViewPreview()
{
AvatarView()
}`

Expected Behavior:

A preview should be seen in AS

A clear description of what you expected to happen.

Hey, could you expand on this? Also, I would recommend you check this doc.

It's enough, thanks