fresco: Error inflating class com.facebook.drawee.view.SimpleDraweeView

Hi. I’ve tried to inflate this guy on adapter, but don’t work! I’m using the last version.

<com.facebook.drawee.view.SimpleDraweeView
  android:id="@+id/camera_image"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  app:placeholderImage="@mipmap/ic_launcher"/>

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

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 29 (2 by maintainers)

Most upvoted comments

    <com.facebook.drawee.view.SimpleDraweeView
            android:layout_gravity="center"
            android:layout_height="100dp"
            android:layout_width="100dp"
            android:background="@color/white"
            android:id="@+id/cover"/>
android.view.InflateException: Binary XML file line #13: Error inflating class com.facebook.drawee.view.SimpleDraweeView
            at android.view.LayoutInflater.createView(LayoutInflater.java:620)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397)

I hava the same trouble~

Solve Method

You should only call Fresco.initialize once. Your Application class would be a good place. Doing it in each Activity is wrong.

add :Fresco.initialize(this); to your Application class.

@ppamorim I have solve this problem. add :Fresco.initialize(this); to your Application.

ok,I solved it. just put

Fresco.initialize(this);

above

setContentView(R.layout.activity_main);

and ,it works now.

This is so tricky. The error message seems totally irrelevant with the solution.

In my case writing Fresco.initialize(this); before setContentView(R.layout.activity_home); worked

Is there anything else in the error message? That should probably be fb:placeholderImage= instead of app:placeholderImage=

you guys sure you registered the application in the manifest? its a small step,but your context wont be valid when you try to init Fresco without android:name="your application name"