Loading Image from Url in Kotlin Compose Using Glide

Loading Image from Url in Kotlin Compose Using Glide

I am trying to load image from a url but it is giving a blank screen. I have the following implementation

class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContent {
        ImageLoadTheme {
            Surface(
                modifier = Modifier.fillMaxSize()
            ) {
                Column {

                   ComposablefunMyView(modifier = Modifier.padding(4.dp))
                }
            }
      }

  @OptIn(ExperimentalGlideComposeApi::class)
  @Composable
  fun ComposablefunMyView(modifier: Modifier) {

    GlideImage(
    model = "",
    contentDescription = "img",
    // Crop, Fit, Inside, FillHeight, FillWidth, None
    contentScale = ContentScale.Crop)
   }

This is what is showing in the log file

W/Glide: Load failed for [ with dimensions [720x1360]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 10 root causes:
java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
java.lang.RuntimeException(setDataSource failed: status = 0x80000000)
java.lang.RuntimeException(setDataSource failed: status = 0x80000000)
java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
java.lang.RuntimeException(setDataSource failed: status = 0x80000000)
java.lang.RuntimeException(setDataSource failed: status = 0x80000000)
 call GlideException#logRootCauses(String) for more detail
  Cause (1 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{DirectByteBuffer->Object->Drawable}, DATA_DISK_CACHE, 
There were 3 root causes:
java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
 call GlideException#logRootCauses(String) for more detail
    Cause (1 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->Drawable->Drawable}
There was 1 root cause:
java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
 call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class java.lang.RuntimeException: setDataSourceCallback failed: status = 0x80000000
    Cause (2 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->Drawable}
    Cause (3 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->Bitmap->BitmapDrawable}
There was 1 root cause:

I have read and applied a few things but none have worked so far. It would be great help if I could find a solution.

3
Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.