title: Couldn't expand RemoteViews for: StatusBarNotification
body: <p>This question has been asked before but none of the answers helped me hence posting my case.</p>
  
  <p>I am trying to build a custom notification using a layout file. But I get the following error:</p>
  
  <blockquote>
    <p>android.app.RemoteServiceException: Bad notification posted from
    package com.eswaraj.app.eswaraj: Couldn't expand RemoteViews for:
    StatusBarNotification(pkg=com.eswaraj.app.eswaraj user=UserHandle{0}
    id=8888 tag=null score=0: Notification(pri=0
    contentView=com.eswaraj.app.eswaraj/0x7f030052 vibrate=null sound=null
    defaults=0x0 flags=0x0 kind=[null]))</p>
  </blockquote>
  
  <p>My layout file is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:gravity="left"&gt;
  
  &lt;com.makeramen.RoundedImageView
      android:id="@+id/nImage"
      android:layout_width="100dp"
      android:layout_height="100dp"
      android:src="@drawable/profile_image"
      android:padding="15dp"
      android:scaleType="fitCenter"
      app:riv_corner_radius="30dip"
      app:riv_border_width="2dip"
      app:riv_border_color="#333333"
      app:riv_mutate_background="true"
      app:riv_oval="true"/&gt;
  
  &lt;TextView
      android:id="@+id/nTitle"
      android:text="eSwaraj: Your voice is heard"
      android:layout_toRightOf="@+id/nImage"
      android:paddingTop="12dp"
      android:textSize="20dp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" /&gt;
  
  &lt;TextView
      android:id="@+id/nMessage"
      android:layout_below="@+id/nTitle"
      android:layout_toRightOf="@+id/nImage"
      android:text="Your comaplaint viewed"
      android:textSize="15dp"
      android:paddingTop="5dp"
      android:layout_width="match_parent"
      android:layout_height="wrap_content" /&gt;
  
  &lt;TextView
      android:id="@+id/nTime"
      android:layout_toRightOf="@+id/nImage"
      android:layout_below="@+id/nMessage"
      android:textSize="13dp"
      android:paddingTop="5dp"
      android:text="12:23PM"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And I am sending notification as follows:</p>
  
  <pre><code>public void sendNotification(Context caller, Class&lt;?&gt; activityToLaunch, Bitmap icon,   GcmMessageDto gcmMessageDto, int id) {
          Intent toLaunch;
          RemoteViews remoteViews = new RemoteViews(caller.getPackageName(), R.layout.notification);
          if(activityToLaunch != null) {
              toLaunch = new Intent(caller, activityToLaunch);
         }
         else {
              toLaunch = new Intent();
          }
          PendingIntent intentBack = PendingIntent.getActivity(caller, 0, toLaunch, 0);
  
          NotificationManager notifier = (NotificationManager) caller.getSystemService(Context.NOTIFICATION_SERVICE);
          NotificationCompat.Builder mBuilder =
                  new NotificationCompat.Builder(caller)
                      .setSmallIcon(android.R.drawable.ic_notification_overlay)
                      .setContentIntent(intentBack);
  
          remoteViews.setTextViewText(R.id.nMessage, gcmMessageDto.getMessage());
          remoteViews.setTextViewText(R.id.nTime, new Date().toString());
          if(icon != null) {
              remoteViews.setImageViewBitmap(R.id.nImage, icon);
          }
          mBuilder.setContent(remoteViews);
  
          notifier.notify(id, mBuilder.build());
      }
  </code></pre>
  
  <p>Any help would be appreciated.</p>