I am using @GET for retrieve data from JSON file. And i have recyclerview and data from the JSON is loaded into this recyclerview. The Recyclerview contains a ImageView, and 2 Textviews. Iam using GLIDE for viewing Image in the Recyclerview. But when I use static URL from the same JSON file the image is displayed. But when I change it nothing shows. Codes are given below.

AbiData.kt

```
data class AbiData(
val id: String,
val img_src: String,
val price: Int,
val type: String)

```

ApiInterface.kt

```
interface ApiInterface {
@GET("realestate")
fun getData(): Call<List<AbiData>>}

```

RecyclerAdapter.kt

```
class abiAdapter (val context: Context, val userList: List<AbiData>) : RecyclerView.Adapter<abiAdapter.ViewHolder>() {

class ViewHolder (itemView: View) : RecyclerView.ViewHolder(itemView) {
    val type : TextView = itemView.findViewById(R.id.type)
    val price : TextView = itemView.findViewById(R.id.price)
    val marsImage : ImageView = itemView.findViewById(R.id.marsImage)

}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): abiAdapter.ViewHolder {
    return ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.rows,parent,false))
}

override fun onBindViewHolder(holder: abiAdapter.ViewHolder, position: Int) {
    val currentItem = userList[position]

    holder.type.text = currentItem.type
    holder.price.text = currentItem.price.toString()
    Glide.with(context).load(currentItem.img_src).centerCrop().placeholder(R.drawable.ic_launcher_foreground).into(holder.marsImage)

}

override fun getItemCount(): Int {
    return userList.size
}

```

}

On 'onBindViewHolder' in Recyclerview change the following line to below The image is showing correctly
**Glide.with(context).load("https://mars.nasa.gov/msl-raw-images/msss/01000/mcam/1000MR0044631300503690E01\_DXXX.jpg").centerCrop().placeholder(R.drawable.ic\_launcher\_foreground).into(holder.marsImage)**

But when change to
Glide.with(context).load(**currentItem.img\_src**).into(holder.marsImage)
Image is not showing

In currentItem.img\_src : The correct url is received. I checked it with breakpoint.

[![enter image description here](https://i.stack.imgur.com/1ZHHD.jpg)](https://i.stack.imgur.com/1ZHHD.jpg)

The output is shown below

[![enter image description here](https://i.stack.imgur.com/Jgdiq.jpg)](https://i.stack.imgur.com/Jgdiq.jpg)

FragmentRecycler.xml

```
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".RecyclerFragment">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/abiRecyclerView"
        android:layout_width="match_parent"
        tools:listitem="@layout/rows"
        android:layout_height="match_parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>

```

row.xml

```
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_height="wrap_content"
    app:cardCornerRadius="20dp"
    android:layout_marginTop="10dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    app:cardBackgroundColor="#F4E6D7"
    android:layout_width="match_parent"
        xmlns:tools="http://schemas.android.com/tools">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="180dp">

        <ImageView
            android:id="@+id/marsImage"
            android:layout_width="170dp"
            android:layout_height="164dp"
            android:layout_marginStart="16dp"
            android:layout_marginTop="8dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"/>

        <TextView
            android:id="@+id/price"
            android:layout_width="174dp"
            android:textSize="30sp"
            android:layout_height="33dp"
            android:textStyle="bold"
            android:layout_marginStart="20dp"
            android:layout_marginTop="88dp"
            android:text="TextView"
            app:layout_constraintStart_toEndOf="@+id/marsImage"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/type"
            android:layout_width="wrap_content"
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:layout_marginTop="36dp"
            android:text="TextView"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.119"
            app:layout_constraintStart_toEndOf="@+id/marsImage"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

```

Logcat

```
2021-06-08 13:00:08.821 1390-1390/com.example.mars W/Glide: Load failed for http://mars.jpl.nasa.gov/msl-raw-images/msss/01000/mcam/1000MR0044631280503688E0B_DXXX.jpg with size [468x451]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
     call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
     call GlideException#logRootCauses(String) for more detail
        Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
     call GlideException#logRootCauses(String) for more detail
          Cause (1 of 1): class com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: -1

```