1

I am displaying List of courses with dummy data. I am using custom layout to show the course. Fetching List of object from the server. Everything is working fine while in the debug mode or running an app on device.

Now When I Build signed APK for Production Mode The data in the list doesn't show up. The data is coming from the server and is also successfully mapped into the list. But It doesn't show up.

enter image description here

Here is the code of my custom layout file.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/tvCourseName"
    android:gravity="center"
    android:textSize="22sp"
    android:layout_marginStart="15dp"
    android:layout_marginEnd="15dp"
    android:layout_marginTop="5dp"
    android:layout_marginBottom="5dp"
    android:textColor="@color/main"
    android:background="@drawable/background_course_name"
    android:text="@string/english"/>
</RelativeLayout>

And here is the code for Adapter.

public View getView(int position, View convertView, ViewGroup parent) {

    LayoutInflater inflater = LayoutInflater.from(getContext());
    View view = inflater.inflate(R.layout.course_row_layout,parent,false);

    response = getItem(position);

    tvCourseName = (TextView)view.findViewById(R.id.tvCourseName);
    tvCourseName.setText(response.getTitle());

    return view;
}
Hobbit
  • 601
  • 1
  • 9
  • 22

3 Answers3

0

If you believe you didn't change anything in the source code, and it only happen in release build, please check your progaurd file. try diable progaurd in release build

put minifyEnabled false in gradle file, then see what happen.

If it is caused by progaurd, try keep your entity class or your customized View from obfuscation

TaoBit
  • 852
  • 7
  • 10
0

Set value is false

 release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
Bryan
  • 2,870
  • 24
  • 39
  • 44
-1

Be sure your model class used implement from Serializable and each attribute in class have @SerializedName, like example:

data class ParcelCategory(
        @SerializedName("created_at")
        val createdAt: String,
        @SerializedName("created_at_jalali")
        val createdAtJalali: String,
        @SerializedName("description")
        val description: String,
        @SerializedName("id")
        val id: Int,
        @SerializedName("inside_pic")
        val insidePic: String,
        @SerializedName("inside_pic_app")
        val insidePicApp: String,
        @SerializedName("is_active")
        val isActive: Int,
        @SerializedName("logo")
        val logo: String,
        @SerializedName("logo_app")
        val logoApp: String,
        @SerializedName("title")
        val title: String,
        @SerializedName("updated_at")
        val updatedAt: String
) : Serializable
tohidmahmoudvand
  • 256
  • 2
  • 14