Android - Get & ldquo; Source not found & rdquo; Error After Adding a Custom Layout

I created a custom layout which is extended from Relative layout and put it into one of the activity. After that I got "Source Not Found" error. The code is very simple so I am not sure what the cause is and how to debug this error.

The code is as follow:

CustomLayout.class

public class CustomLayout extends RelativeLayout{

public CustomLayout(Context context) {
    super(context);
    init();
}

public void init() {
    this.inflate(getContext(), R.layout.custom_layout, this);
}

custom_layout.xml

<?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="match_parent" >

</RelativeLayout>

MyActivityLayout.xml

......
<com.example.view.CustomLayout
     android:layout_width="match_parent"
     android:layout_height="match_parent" />
......


You have to create another constructor having Context and AttributeSet as its parameters.

public CommentBarLayout(Context context,AttributeSet attrs) { super(context,attrs); }