Exception loading Facebook Login Button in Android Studio -
i want make app facebook integration. i'm using android studio 1.1.0. i'm able import facebook skd 4.0.0 in build.gradle (module:app) , use in java code:
apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion "22.0.1" defaultconfig { applicationid "package.test" minsdkversion 15 targetsdkversion 21 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { mavencentral() } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.facebook.android:facebook-android-sdk:4.0.0' }
i put loginbutton layout file activity:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" ... tools:context=".mainactivity"> <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_margintop="30dp" /> </relativelayout>
this exception thrown @ setcontentview(layoutfile)
.
i checked samples in facebook sdk on github doesn't helped me fix problem. import of facebook sdk correctly?
thanks in advance!
you need call facebooksdk.sdkinitialize in activity or application oncreate.
Comments
Post a Comment