xml - Could not initialize LoginButton Facebook-sdk for android -


im working on android project want put facebook login feature, added facebook sdk correctly not initialize loginbutton

**java.lang.noclassdeffounderror: not initialize class       com.facebook.login.widget.loginbutton** @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:57) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) @ java.lang.reflect.constructor.newinstance(constructor.java:526) @ org.jetbrains.android.uipreview.viewloader.createnewinstance(viewloader.java:413) @ org.jetbrains.android.uipreview.viewloader.loadview(viewloader.java:105) @ com.android.tools.idea.rendering.layoutlibcallback.loadview(layoutlibcallback.java:176) @ android.view.bridgeinflater.loadcustomview(bridgeinflater.java:207) @ android.view.bridgeinflater.createviewfromtag(bridgeinflater.java:132) @ android.view.layoutinflater.rinflate_original(layoutinflater.java:806) @ android.view.layoutinflater_delegate.rinflate(layoutinflater_delegate.java:64) @ android.view.layoutinflater.rinflate(layoutinflater.java:782) @ android.view.layoutinflater.inflate(layoutinflater.java:504) @ android.view.layoutinflater.inflate(layoutinflater.java:385) @ com.android.layoutlib.bridge.impl.rendersessionimpl.inflate(rendersessionimpl.java:400) @ com.android.layoutlib.bridge.bridge.createsession(bridge.java:332) @ com.android.ide.common.rendering.layoutlibrary.createsession(layoutlibrary.java:350) @ com.android.tools.idea.rendering.renderservice$5.compute(renderservice.java:708) @ com.android.tools.idea.rendering.renderservice$5.compute(renderservice.java:697) @ com.intellij.openapi.application.impl.applicationimpl.runreadaction(applicationimpl.java:932) @ com.android.tools.idea.rendering.renderservice.createrendersession(renderservice.java:697) @ com.android.tools.idea.rendering.renderservice.render(renderservice.java:816) @ com.intellij.android.designer.designsurface.androiddesignereditorpanel$6.run(androiddesignereditorpanel.java:480) @ com.intellij.util.ui.update.mergingupdatequeue.execute(mergingupdatequeue.java:320) @ com.intellij.util.ui.update.mergingupdatequeue.execute(mergingupdatequeue.java:310) @ com.intellij.util.ui.update.mergingupdatequeue$2.run(mergingupdatequeue.java:254) @ com.intellij.util.ui.update.mergingupdatequeue.flush(mergingupdatequeue.java:269) @ com.intellij.util.ui.update.mergingupdatequeue.flush(mergingupdatequeue.java:227) @ com.intellij.util.ui.update.mergingupdatequeue.run(mergingupdatequeue.java:217) @ com.intellij.util.concurrency.queueprocessor.runsafely(queueprocessor.java:238) @ com.intellij.util.alarm$request$1.run(alarm.java:327) @ java.util.concurrent.executors$runnableadapter.call(executors.java:471) @ java.util.concurrent.futuretask.run(futuretask.java:262) @   java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @    java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:745) 

here appmanifest.xml :

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

<uses-permission android:name="android.permission.internet"/>  <application     android:allowbackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:theme="@style/apptheme" >      <activity         android:name=".helloactivity"         android:label="@string/title_activity_hello" >     </activity>      <activity android:name="com.facebook.facebookactivity"         android:configchanges=             "keyboard|keyboardhidden|screenlayout|screensize|orientation"         android:theme="@android:style/theme.translucent.notitlebar"         android:label="@string/app_name" />     <meta-data android:name="com.facebook.sdk.applicationid" android:value="@string/app_id"/> </application> 

i specified app_id in strings.xml. help

this due non-initialization of facebooksdk before usage. add below line:

facebooksdk.sdkinitialize(mcontext);

in case host of loginbutton is:
1.activity- before setcontentview(r.layout.activity_main)
2.fragment- before inflater.inflate(r.layout.fragment_main, container, false)

also don't forget listen callback in onactivityresult() in above cases update ui of loginbutton.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -