You may face the following error when integrating facebook sdk with Android :
java.lang.NullPointerException: Argument 'applicationId' cannot be null.
If you are getting the above error even though you specified the facebook applicationId in manifest file as follows:
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="123456785678" />
Reason:
Reason for the above error is due to the ApplicationId is mentioned as Integer , as we specified directly in manifest . But facebook SDK needs ApplicationId value as String. So if we pass ApplicationId as above, inside facebook SDK 'ClassCastException' occurs and considers ApplicationId value as null.
Solution:
Declare APP_ID value in strings.xml as follows:
<string name="APP_ID">123456785678</string>
And then refer this APP_ID as ApplicationId value in manifest file:
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/APP_ID" />
Please share your comments on this , if it is helped ...
thanks, i'll try.
ReplyDeleteI'm having this issue
Hi Minu,
DeleteDid you resolve issue ?
I'm having the same problem, but I'm inserting metadata tag aparently right:
ReplyDeleteso, I receive "argument applicationid cannot be null", can you help me please?
Thanks,I resolve this but,
ReplyDeleteanother error I am getting is Noclassdeffound in loginactivity of facebook
Please help
This comment has been removed by the author.
DeleteHi Prachi,
ReplyDeleteI think you have not specified activity android name com.facebook.LoginActivity in your project manifest file.
Hope it helps.
Hello, I have refer app id using string value still i am getting same null poiner error. have some solution?
ReplyDeletethank you very much .really this is very helpful
ReplyDelete