Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ppamorim opened this issue Apr 2, 2015 · 29 comments
Closed

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

ppamorim opened this issue Apr 2, 2015 · 29 comments

Comments

@ppamorim
Copy link

ppamorim commented Apr 2, 2015

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

@IanChilds
Copy link
Contributor

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

@ppamorim
Copy link
Author

ppamorim commented Apr 2, 2015

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

@ppamorim ppamorim closed this as completed Apr 2, 2015
@andforce
Copy link

    <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
Copy link

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

@jpicoquares
Copy link

Thanks for your response andforce

@lkw103037
Copy link

it's right

@passos
Copy link

passos commented May 28, 2015

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

@ManMegh
Copy link

ManMegh commented Jun 16, 2015

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

@IvanAliaga
Copy link

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

@tyronen
Copy link
Contributor

tyronen commented Jun 22, 2015

Is this the same stack trace as issue #395?

@yrizk
Copy link

yrizk commented Aug 1, 2015

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"

@vivian8725118
Copy link

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

@vivian8725118
Copy link

ok,I solved it.
just put

Fresco.initialize(this);

above

setContentView(R.layout.activity_main);

and ,it works now.

@goodlifechris
Copy link

thanks it worked

@andforce
Copy link

andforce commented Oct 9, 2015

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

@goodlifechris
Copy link

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

On Fri, Oct 9, 2015 at 7:32 AM, andforce notifications@github.com 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
#74 (comment).

@goodlifechris
Copy link

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 <
christopherndugo@gmail.com> wrote:

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

On Fri, Oct 9, 2015 at 7:32 AM, andforce notifications@github.com 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
#74 (comment).

@saumil11
Copy link

saumil11 commented Feb 8, 2016

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

@arenaq
Copy link

arenaq commented Apr 5, 2016

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.

@bogdantudorascu
Copy link

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

@arenaq
Copy link

arenaq commented Apr 19, 2016

@iDaniel19 paste in your XML

@bogdantudorascu
Copy link

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
              android:orientation="vertical">


<com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/profileImage"
        fresco:actualImageScaleType="centerCrop"
        android:layout_width="200dp"
        android:layout_gravity="center_horizontal"
        android:layout_height="200dp" />
</LinearLayout>

@bogdantudorascu
Copy link

bogdantudorascu commented Apr 19, 2016

I found the problem . I had FacebookSdk.sdkInitialize(this); instead of Fresco.initialize(this);.

@arenaq
Copy link

arenaq commented Apr 20, 2016

@iDaniel19 Glad you solved it. Cheers!

@huopochuan
Copy link

3Q

@aneeshATgithub
Copy link

use following version, and you can initialize fresco in Application class

compile 'com.facebook.fresco:fresco:0.12.0'

@ravivlb
Copy link

ravivlb commented Jul 2, 2017

facing same issue after updating 1.3.0.

Initialised inside the application class,
Fresco.initialize(this);

Error

FATAL EXCEPTION: main
Process: com.fetchr.driver.android.alpha, PID: 29053
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fetchr.driver.android.alpha/com.fetchr.driver.android.screens.welcome.WelcomeActivity}: android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class com.facebook.drawee.view.SimpleDraweeView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class com.facebook.drawee.view.SimpleDraweeView
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.fetchr.driver.android.base.ButterAppCompatActivity.setContentView(ButterAppCompatActivity.java:49)
at com.fetchr.driver.android.screens.welcome.WelcomeActivity.onCreate(WelcomeActivity.java:45)
at android.app.Activity.performCreate(Activity.java:6876)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7225) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class com.facebook.drawee.view.SimpleDraweeView
at android.view.LayoutInflater.createView(LayoutInflater.java:657)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.createCustomViewInternal(CalligraphyLayoutInflater.java:211)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.access$000(CalligraphyLayoutInflater.java:20)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$PrivateWrapperFactory2.onCreateView(CalligraphyLayoutInflater.java:302)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:192)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:766)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:855)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.fetchr.driver.android.base.ButterAppCompatActivity.setContentView(ButterAppCompatActivity.java:49) 
at com.fetchr.driver.android.screens.welcome.WelcomeActivity.onCreate(WelcomeActivity.java:45) 
at android.app.Activity.performCreate(Activity.java:6876) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7225) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:631)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.createCustomViewInternal(CalligraphyLayoutInflater.java:211) 
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.access$000(CalligraphyLayoutInflater.java:20) 
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$PrivateWrapperFactory2.onCreateView(CalligraphyLayoutInflater.java:302) 
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:192) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:766) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.fetchr.driver.android.base.ButterAppCompatActivity.setContentView(ButterAppCompatActivity.java:49) 
at com.fetchr.driver.android.screens.welcome.WelcomeActivity.onCreate(WelcomeActivity.java:45) 
at android.app.Activity.performCreate(Activity.java:6876) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7225) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable-xxxhdpi-v4/icn_profile_main.png"
at java.lang.Integer.invalidInt(Integer.java:138)
at java.lang.Integer.parse(Integer.java:410)
at java.lang.Integer.parseInt(Integer.java:367)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:133)
at android.content.res.TypedArray.getInt(TypedArray.java:357)
at com.facebook.drawee.generic.GenericDraweeHierarchyInflater.updateBuilder(GenericDraweeHierarchyInflater.java:127)
at com.facebook.drawee.generic.GenericDraweeHierarchyInflater.inflateBuilder(GenericDrawee

@iq5sa
Copy link

iq5sa commented Sep 10, 2017

solved thank you vivian8725118

@ghost
Copy link

ghost commented Oct 24, 2018

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

thank you brother , i got the output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests