I can’t use Loginbutton from Facebook SDK

Asked

Viewed 82 times

0

Every time I try to insert it the application compiles but does not run, closes automatically with the following exception`

java.lang.RuntimeException: Unable to start activity ComponentInfo{se.speedle.android/com.bryderi.speedle.android.activity.MainActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class com.facebook.widget.LoginButton at android.app.Activitythread.performLaunchActivity(Activitythread.java:2211) at android.app.Activitythread.handleLaunchActivity(Activitythread.java:2261) at android.app.Activitythread.access$600(Activitythread.java:141) at android.app.Activitythread$H.handleMessage(Activitythread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.Activitythread.main(Activitythread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.Internal.os.Zygoteinit$Methodandargscaller.run(Zygoteinit.java:737) at com.android.Internal.os.Zygoteinit.main(Zygoteinit.java:553) at Dalvik.system.Nativestart.main(Native Method) Caused by: android.view.Inflateexception: Binary XML file line #26: Error inflating class com.facebook.widget.Loginbutton at android.view.Layoutinflater.createViewFromTag(Layoutinflater.java:707) at android.view.Layoutinflater.rInflate(Layoutinflater.java:755) at android.view.Layoutinflater.rInflate(Layoutinflater.java:758) at android.view.Layoutinflater.inflate(Layoutinflater.java:492) at android.view.Layoutinflater.inflate(Layoutinflater.java:397) at android.view.Layoutinflater.inflate(Layoutinflater.java:353) at android.support.v7.app.Actionbaractivitydelegatebase.setContentView(Actionbaractivitydelegatebase.java:228) at android.support.v7.app.Actionbaractivity.setContentView(Actionbaractivity.java:102) with.bryderi.Speedle.android.Activity.MainActivity.onCreate(Mainactivity.java:36) at android.app.Activity.performCreate(Activity.java:5133) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.Activitythread.performLaunchActivity(Activitythread.java:2175) at android.app.Activitythread.handleLaunchActivity(Activitythread.java:2261) at android.app.Activitythread.access$600(Activitythread.java:141) at android.app.Activitythread$H.handleMessage(Activitythread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.Activitythread.main(Activitythread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.Internal.os.Zygoteinit$Methodandargscaller.run(Zygoteinit.java:737) at com.android.Internal.os.Zygoteinit.main(Zygoteinit.java:553) at Dalvik.system.Nativestart.main(Native Method) Caused by: java.lang.Classnotfoundexception: Didn’t find class "com.facebook.widget.Loginbutton" on path: Dexpathlist[zip file "/data/app/se.speedle.android-1.apk"],nativeLibraryDirectories=[/data/app-lib/se.speedle.android-1, /system/lib]] at Dalvik.system.Basedexclassloader.findClass(Basedexclassloader.java:53) at java.lang.Classloader.loadClass(Classloader.java:501) at java.lang.Classloader.loadClass(Classloader.java:461) at android.view.Layoutinflater.createView(Layoutinflater.java:559) at android.view.Layoutinflater.createViewFromTag(Layoutinflater.java:696) at android.view.Layoutinflater.rInflate(Layoutinflater.java:755) at android.view.Layoutinflater.rInflate(Layoutinflater.java:758) at android.view.Layoutinflater.inflate(Layoutinflater.java:492) at android.view.Layoutinflater.inflate(Layoutinflater.java:397) at android.view.Layoutinflater.inflate(Layoutinflater.java:353) at android.support.v7.app.Actionbaractivitydelegatebase.setContentView(Actionbaractivitydelegatebase.java:228) at android.support.v7.app.Actionbaractivity.setContentView(Actionbaractivity.java:102) with.bryderi.Speedle.android.Activity.MainActivity.onCreate(Mainactivity.java:36) at android.app.Activity.performCreate(Activity.java:5133) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.Activitythread.performLaunchActivity(Activitythread.java:2175) at android.app.Activitythread.handleLaunchActivity(Activitythread.java:2261) at android.app.Activitythread.access$600(Activitythread.java:141) at android.app.Activitythread$H.handleMessage(Activitythread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.Activitythread.main(Activitythread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525)

I already searched in Stack gringo and some say to call the method Sdkinitialize, but this method is currently obsolete and the Sdk already initializes alone. Even calling doesn’t work. Someone has an idea of what might be?

  • There are already several questions with answer on the subject, check if any meets you.

  • Try to edit your question and insert the code you think relevant in it. For example XML.

  • The answers below help you or need some more information?!

  • No. I ended up doing it another way, according to the Facebook documentation. I’ve eliminated errors, compile, run, but it’s still not possible to log in if you can look at Github... https://github.com/DouglasDRF/Approach/issues

1 answer

0

The mistake you are making in your application is exactly when inflating the LoginButton:

android.view.Inflateexception: Binary XML file line #26: Error inflating class com.facebook.widget.Loginbutton at at

If you are using Facebook SDK 4+ you need to change the tag from its button to com.facebook.login.widget.LoginButton in your XML. See:

<com.facebook.login.widget.LoginButton
    android:id="@+id/btnLoginFabook"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:text="Login com Fabook" />

Otherwise it must remain com.facebook.widget.LoginButton.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.