question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

android.view.InflateException: Binary XML file line #40: Error inflating class com.facebook.drawee.view.SimpleDraweeView

See original GitHub issue

09-05 18:08:08.701: E/AndroidRuntime(25531): android.view.InflateException: Binary XML file line #40: Error inflating class com.facebook.drawee.view.SimpleDraweeView 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.LayoutInflater.createView(LayoutInflater.java:639) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:749) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.LayoutInflater.rInflate(LayoutInflater.java:812) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.LayoutInflater.rInflate(LayoutInflater.java:815) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.LayoutInflater.inflate(LayoutInflater.java:510) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.LayoutInflater.inflate(LayoutInflater.java:420) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.LayoutInflater.inflate(LayoutInflater.java:371) 09-05 18:08:08.701: E/AndroidRuntime(25531): at io.moodbox.module.mood.adapter.MoodTimelineListAdapter.getView(MoodTimelineListAdapter.java:68) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.AbsListView.obtainView(AbsListView.java:2572) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.ListView.makeAndAddView(ListView.java:1953) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.ListView.fillDown(ListView.java:754) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.ListView.fillFromTop(ListView.java:819) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.ListView.layoutChildren(ListView.java:1748) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.AbsListView.onLayout(AbsListView.java:2332) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.View.layout(View.java:16112) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewGroup.layout(ViewGroup.java:5185) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:543) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.View.layout(View.java:16112) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewGroup.layout(ViewGroup.java:5185) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.FrameLayout.onLayout(FrameLayout.java:574) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.View.layout(View.java:16112) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewGroup.layout(ViewGroup.java:5185) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.FrameLayout.onLayout(FrameLayout.java:574) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.View.layout(View.java:16112) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewGroup.layout(ViewGroup.java:5185) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.LinearLayout.onLayout(LinearLayout.java:1722) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.View.layout(View.java:16112) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewGroup.layout(ViewGroup.java:5185) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.FrameLayout.onLayout(FrameLayout.java:574) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.View.layout(View.java:16112) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewGroup.layout(ViewGroup.java:5185) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.LinearLayout.onLayout(LinearLayout.java:1722) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.View.layout(View.java:16112) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewGroup.layout(ViewGroup.java:5185) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.widget.FrameLayout.onLayout(FrameLayout.java:574) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.View.layout(View.java:16112) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewGroup.layout(ViewGroup.java:5185) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2525) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2217) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1314) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6673) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.Choreographer.doCallbacks(Choreographer.java:603) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.Choreographer.doFrame(Choreographer.java:572) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.os.Handler.handleCallback(Handler.java:815) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.os.Handler.dispatchMessage(Handler.java:104) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.os.Looper.loop(Looper.java:194) 09-05 18:08:08.701: E/AndroidRuntime(25531): at android.app.ActivityThread.main(ActivityThread.java:5824) 09-05 18:08:08.701: E/AndroidRuntime(25531): at java.lang.reflect.Method.invoke(Native Method) 09-05 18:08:08.701: E/AndroidRuntime(25531): at java.lang.reflect.Method.invoke(Method.java:372) 09-05 18:08:08.701: E/AndroidRuntime(25531): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1010) 09-05 18:08:08.701: E/AndroidRuntime(25531): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) 09-05 18:08:08.701: E/AndroidRuntime(25531): Caused by: java.lang.reflect.InvocationTargetException 09-05 18:08:08.701: E/AndroidRuntime(25531): at java.lang.refle

Here is my layout.xml for ListView item(R.layout.lstv_mood_timeline_item)…

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:fresco="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" >

<LinearLayout android:id="@+id/timelineMoodFlag" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:orientation="horizontal">
    <ImageView
        android:id="@+id/timelineMoodIcon"
        android:layout_width="@dimen/timeline_mood_card_emoticon_wh"
        android:layout_height="@dimen/timeline_mood_card_emoticon_wh"
        android:contentDescription="@null"
        android:layout_gravity="center"
        android:src="@drawable/mood_good" />
</LinearLayout>


<LinearLayout 
    android:id="@+id/timelineMoodCardTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_toRightOf="@id/timelineMoodFlag"
    android:orientation="horizontal"
    android:padding="@dimen/gap_with_screen" >

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/timelineMoodAuthorAvatar"
        android:layout_width="@dimen/timeline_mood_author_avatar_wh"
        android:layout_height="@dimen/timeline_mood_author_avatar_wh"
        fresco:roundAsCircle="true"/>

    <TextView
        android:id="@+id/timelineMoodAuthorName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical" />

    <TextView
        android:id="@+id/timelineMoodPostTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical" />
</LinearLayout>
</RelativeLayout>

Here is my ListView adapter getView method snippet:

.line 64 @Override .line 65 public View getView(int position, View convertView, ViewGroup parent) { .line 66 MoodTimelineItemHolder holder = null; .line 67 if (convertView == null) { .line 68 convertView = inflater.inflate(R.layout.lstv_mood_timeline_item, null); .line 69 holder = new MoodTimelineItemHolder();

Here is my Application snippet:

public class MoodBoxApplication extends Application {

@Override
public void onCreate() {
    super.onCreate();
    Fresco.initialize(this);
}

}

Here is lib: bolts-tasks-1.4.0.jar drawee-v0.13.0.jar fbcore-v0.13.0.jar fresco-v0.13.0.jar imagepipeline-base-v0.13.0.jar imagepipeline-v0.13.0.jar

environment: android-21 java 7

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kirwancommented, Mar 2, 2018

@minaee Your root cause appears to be the following, which is unrelated to Fresco.

Caused by: java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead
at android.widget.AdapterView.setOnClickListener(AdapterView.java:1007)
0reactions
minaeecommented, Mar 2, 2018

@kirwan

public class WifiP2pDeviceAdapter extends BaseAdapter implements View.OnClickListener {
private Context mContext;
private ArrayList<WifiP2pDevice> mData;
public WifiP2pDeviceAdapter(Context context,ArrayList<WifiP2pDevice> list){
    mContext = context;
    mData = list;

}

@Override
public int getCount() {
    return mData.size();
}

@Override
public Object getItem(int position) {
    return mData.get(position);
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    /*if (convertView == null){
        convertView = LayoutInflater.from(mContext).inflate(R.layout.item_wifip2p_device,null);
    }*/
    convertView.setTag(position);
    //convertView.setOnClickListener(this);
    TextView textView = (TextView) convertView.findViewById(R.id.msg);
    textView.setText(mData.get(position).toString());

    return convertView;
    }


    @Override
     public void onClick(View v) {
     int position = Integer.parseInt(v.getTag().toString());
     WifiP2pDevice device = mData.get(position);
     switch (device.status){
        case WifiP2pDevice.AVAILABLE:
        case WifiP2pDevice.CONNECTED:
        case WifiP2pDevice.INVITED:
            ((MainActivity)mContext).connect(device);
            break;
        case WifiP2pDevice.FAILED:
        case WifiP2pDevice.UNAVAILABLE:
        
  Toast.makeText(mContext,String.format(Locale.getDefault(),"status=%d",device.status),
 Toast.LENGTH_SHORT).show();
            break;
     }

  }
  }

this is my adapter class i cant implement setOnItemClickListener what do you suggest ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

android.view.InflateException: Binary XML file line #40
android.view.InflateException: Binary XML file line #40: Error inflating class com.facebook.drawee.view.SimpleDraweeView.
Read more >
Android - Exception Error inflating class com.facebook.drawee ...
InflateException : Binary XML file line #22: Error inflating class com.facebook.drawee.view.SimpleDraweeView Caused by java.lang.reflect.
Read more >
android.view.InflateException: Binary XML file line #2: Error ...
Caused by: android. view. InflateException : Binary XML file line #2: Error inflating class unknowntag... error inflating class unknown ...
Read more >
Binary XML file line Error inflating class ImageView in Android ...
InflateException : Binary XML file line | Error inflating class ImageViewfacebook page : https://www. facebook.com/Code-Prof-110511874050372/
Read more >
Using SimpleDraweeView - Fresco
These can be used in XML layouts. ... When using Fresco, you will use SimpleDraweeView to display images. ... <com.facebook.drawee.view.SimpleDraweeView ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found