Exception when running a simple android facebook integration program using Parse -


i have made simple program facebook integration of android using "parse" have used following code showing exception code , logcat shown below:

main.java

package com.example.facbk;

import com.facebook.android.asyncfacebookrunner; import com.facebook.android.facebook; import com.parse.logincallback; import com.parse.parse; import com.parse.parsefacebookutils; import com.parse.parseuser; import android.net.parseexception; import android.os.bundle; import android.provider.syncstatecontract.constants; import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.util.log; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button;  public class mainactivity extends activity {     private static string app_id =" 454641867918042";     private facebook facebook;     private asyncfacebookrunner masyncrunner;     string filename = "androidsso_data";     button login;     private sharedpreferences mprefs;     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         parse.initialize(this, "454641867918042", "awed6rra18hqjnvueczevuqqpkkdkaxp8mop3ip");// try adding method before parsefacebookutils.initialize()         parsefacebookutils.initialize("454641867918042");         setcontentview(r.layout.activity_main);         system.out.println("hello login");         parsefacebookutils.login(this, new logincallback() {              @override             public void done(parseuser user, com.parse.parseexception arg1) {                 // todo auto-generated method stub                  if (user == null) {                       log.d("myapp", "uh oh. user cancelled facebook login.");                     } else if (user.isnew()) {                       log.d("myapp", "user signed , logged in through facebook!");                     } else {                       log.d("myapp", "user logged in through facebook!");                     }             }             });      }     @override     protected void onactivityresult(int requestcode, int resultcode, intent data) {       super.onactivityresult(requestcode, resultcode, data);       parsefacebookutils.finishauthentication(requestcode, resultcode, data);     }  } 

logcat

07-11 11:04:34.751: i/dalvikvm(8972): threadid=3: reacting signal 3 07-11 11:04:34.951: i/dalvikvm(8972): wrote stack traces '/data/anr/traces.txt' 07-11 11:04:35.190: i/dalvikvm(8972): threadid=3: reacting signal 3 07-11 11:04:35.331: i/dalvikvm(8972): wrote stack traces '/data/anr/traces.txt' 07-11 11:04:35.631: i/system.out(8972): hello login 07-11 11:04:35.701: i/dalvikvm(8972): threadid=3: reacting signal 3 07-11 11:04:35.801: d/androidruntime(8972): shutting down vm 07-11 11:04:35.801: i/dalvikvm(8972): wrote stack traces '/data/anr/traces.txt' 07-11 11:04:35.831: w/dalvikvm(8972): threadid=1: thread exiting uncaught exception (group=0x409c01f8) 07-11 11:04:35.850: e/androidruntime(8972): fatal exception: main 07-11 11:04:35.850: e/androidruntime(8972): java.lang.runtimeexception: unable start activity componentinfo{com.example.facbk/com.example.facbk.mainactivity}: com.facebook.facebookexception: cannot use sessionloginbehavior sso_with_fallback when com.facebook.loginactivity not declared activity in androidmanifest.xml 07-11 11:04:35.850: e/androidruntime(8972):     @ android.app.activitythread.performlaunchactivity(activitythread.java:1956) 07-11 11:04:35.850: e/androidruntime(8972):     @ android.app.activitythread.handlelaunchactivity(activitythread.java:1981) 07-11 11:04:35.850: e/androidruntime(8972):     @ android.app.activitythread.access$600(activitythread.java:123) 07-11 11:04:35.850: e/androidruntime(8972):     @ android.app.activitythread$h.handlemessage(activitythread.java:1147) 07-11 11:04:35.850: e/androidruntime(8972):     @ android.os.handler.dispatchmessage(handler.java:99) 07-11 11:04:35.850: e/androidruntime(8972):     @ android.os.looper.loop(looper.java:137) 07-11 11:04:35.850: e/androidruntime(8972):     @ android.app.activitythread.main(activitythread.java:4424) 07-11 11:04:35.850: e/androidruntime(8972):     @ java.lang.reflect.method.invokenative(native method) 07-11 11:04:35.850: e/androidruntime(8972):     @ java.lang.reflect.method.invoke(method.java:511) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:784) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:551) 07-11 11:04:35.850: e/androidruntime(8972):     @ dalvik.system.nativestart.main(native method) 07-11 11:04:35.850: e/androidruntime(8972): caused by: com.facebook.facebookexception: cannot use sessionloginbehavior sso_with_fallback when com.facebook.loginactivity not declared activity in androidmanifest.xml 07-11 11:04:35.850: e/androidruntime(8972):     @ com.facebook.session.validateloginbehavior(session.java:992) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.facebook.session.open(session.java:915) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.facebook.session.openforread(session.java:385) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.parse.auth.facebookauthenticationprovider.authenticate(facebookauthenticationprovider.java:156) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.parse.parseuser.authenticateasync(parseuser.java:1091) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.parse.parseuser.loginwithasync(parseuser.java:1108) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.parse.parseuser.loginwithasync(parseuser.java:933) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.parse.parsefacebookutils.login(parsefacebookutils.java:338) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.parse.parsefacebookutils.login(parsefacebookutils.java:363) 07-11 11:04:35.850: e/androidruntime(8972):     @ com.example.facbk.mainactivity.oncreate(mainactivity.java:35) 07-11 11:04:35.850: e/androidruntime(8972):     @ android.app.activity.performcreate(activity.java:4465) 07-11 11:04:35.850: e/androidruntime(8972):     @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1049) 07-11 11:04:35.850: e/androidruntime(8972):     @ android.app.activitythread.performlaunchactivity(activitythread.java:1920) 07-11 11:04:35.850: e/androidruntime(8972):     ... 11 more 07-11 11:04:36.190: i/dalvikvm(8972): threadid=3: reacting signal 3 07-11 11:04:36.230: i/dalvikvm(8972): wrote stack traces '/data/anr/traces.txt' 07-11 11:04:36.421: i/dalvikvm(8972): threadid=3: reacting signal 3 07-11 11:04:36.471: i/dalvikvm(8972): wrote stack traces '/data/anr/traces.txt' 

i don't know work or not try : call parse.initialize()

your code in oncreate should

super.oncreate(savedinstancestate); parse.initialize(this, constants.application_id, constants.client_key);// try adding method before parsefacebookutils.initialize() parsefacebookutils.initialize("454641867918042"); setcontentview(r.layout.activity_main); 

edit:

also check internet permission in androidmanifest.xml

<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> 

edit:

add following androidmanifest.xml

<activity     android:name="com.facebook.loginactivity"      > </activity> 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -