fresco icon indicating copy to clipboard operation
fresco copied to clipboard

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

Open ppamorim opened this issue 11 years ago • 29 comments

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...

ppamorim avatar Apr 02 '15 12:04 ppamorim

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

IanChilds avatar Apr 02 '15 13:04 IanChilds

@IanChilds, This hasn't relation with the problem. If I remove this line, the problem still happens.

ppamorim avatar Apr 02 '15 13:04 ppamorim

    <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.

andforce avatar Apr 13 '15 04:04 andforce

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

andforce avatar Apr 13 '15 05:04 andforce

Thanks for your response andforce

jpicoquares avatar Apr 13 '15 12:04 jpicoquares

it's right

lkw103037 avatar Apr 30 '15 02:04 lkw103037

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

passos avatar May 28 '15 01:05 passos

I have placed the Fresco.initialize(this); in my application, but still error is there...

@Override protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    Fresco.initialize(this);
    setContentView(R.layout.activity_main);



    Uri uri = Uri.parse("https://raw.githubusercontent.com/facebook/fresco/gh-pages/static/fresco-logo.png");
    SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.my_image_view);
    draweeView.setImageURI(uri);
}

Above is the code... Please Please Please Help me Friends...

ManMegh avatar Jun 16 '15 05:06 ManMegh

In case you want to implement using a fragment as would be? I have the same problem as everyone else. Best Regards!

IvanAliaga avatar Jun 18 '15 06:06 IvanAliaga

Is this the same stack trace as issue #395?

tyronen avatar Jun 22 '15 11:06 tyronen

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"

yrizk avatar Aug 01 '15 22:08 yrizk

I have the same problem too~how can i solve it?

vivian8725118 avatar Sep 21 '15 04:09 vivian8725118

ok,I solved it. just put

Fresco.initialize(this);

above

setContentView(R.layout.activity_main);

and ,it works now.

vivian8725118 avatar Sep 21 '15 04:09 vivian8725118

thanks it worked

goodlifechris avatar Oct 07 '15 22:10 goodlifechris

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

andforce avatar Oct 09 '15 04:10 andforce

Thanks bro worked perfectly though not using fresco am using picasso. Regards

On Fri, Oct 9, 2015 at 7:32 AM, andforce [email protected] wrote:

@ManMegh https://github.com/ManMegh @vivian8725118 https://github.com/vivian8725118 You should only call Fresco.initialize once. Your Application class would be a good place. Doing it in each Activity is wrong.

— Reply to this email directly or view it on GitHub https://github.com/facebook/fresco/issues/74#issuecomment-146753597.

goodlifechris avatar Oct 10 '15 08:10 goodlifechris

ssup bro,

I would like more of your tutorials how can i get them. Regards

On Sat, Oct 10, 2015 at 11:07 AM, christopher pius ndugo < [email protected]> wrote:

Thanks bro worked perfectly though not using fresco am using picasso. Regards

On Fri, Oct 9, 2015 at 7:32 AM, andforce [email protected] wrote:

@ManMegh https://github.com/ManMegh @vivian8725118 https://github.com/vivian8725118 You should only call Fresco.initialize once. Your Application class would be a good place. Doing it in each Activity is wrong.

— Reply to this email directly or view it on GitHub https://github.com/facebook/fresco/issues/74#issuecomment-146753597.

goodlifechris avatar Oct 14 '15 06:10 goodlifechris

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

saumil11 avatar Feb 08 '16 22:02 saumil11

My problem was not specifing the whole path com.facebook.drawee.view.SimpleDraweeView (I had just SimpleDraweeView). IF that is not your case, check the line of XML file on which the error occured.

arenaq avatar Apr 05 '16 14:04 arenaq

I have the same problem and none of the solutions above is working for me.

bogdantudorascu avatar Apr 19 '16 16:04 bogdantudorascu