android - facebook sdk v4.2 shows Error inflating class com.facebook.login.widget.LoginButton -


i know common question, have read through stack overflow questions without finding answer.it shows error inflating class com.facebook.login.widget.loginbutton. here code

<com.facebook.login.widget.loginbutton         android:id="@+id/login_button"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="center_horizontal"         android:layout_marginbottom="30dp"         android:layout_below="@+id/or"         android:layout_alignleft="@+id/login_email_tv"         android:layout_alignright="@+id/login_email"         android:layout_margintop="10dp"          />  

and basic code

public class login_activity extends activity {

// facebook app id     private static string app_id = "xxxxxxxxxxxxxxxxxxx";         callbackmanager callbackmanager;  //imagebutton fb_login; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.login_activity);        facebooksdk.sdkinitialize(this.getapplicationcontext());          callbackmanager = callbackmanager.factory.create();          loginmanager.getinstance().registercallback(callbackmanager,                 new facebookcallback<loginresult>() {                     @override                     public void onsuccess(loginresult loginresult) {                         // app code                     }                      @override                     public void oncancel() {                          // app code                     }                      @override                     public void onerror(facebookexception exception) {                          // app code                        }         });    }    @override protected void onactivityresult(int requestcode, int resultcode, intent data) {     super.onactivityresult(requestcode, resultcode, data);     callbackmanager.onactivityresult(requestcode, resultcode, data); } 

}

any 1 please give me suggestions this.am new android

have integrated facebook sdk project? check build.gradle

you need add facebook module dependencies in build.gradle

dependencies {    compile filetree(include: ['*.jar'], dir: 'libs')    compile project(':facebook') } 

as well, facebook module should imported in settings.gradle:

include ':app', ':facebook' 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -