0
votes

I tried to add an Facebook login button to my app, but when I follow the instructions on the appcelerator Facebook module description, I got this error:

[ERROR] :  TiApplication: (main) [10,1000] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{ch.inaffect.legi/org.appcelerator.titanium.TiActivity}: Unexpected CallbackManager, please use the provided Factory.; Titanium 5.2.0,2016/02/20 08:05,384775e
[ERROR] :  TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{ch.inaffect.legi/org.appcelerator.titanium.TiActivity}: Unexpected CallbackManager, please use the provided Factory.
[ERROR] :  TiApplication:   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
[ERROR] :  TiApplication:   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
[ERROR] :  TiApplication:   at android.app.ActivityThread.-wrap11(ActivityThread.java)
[ERROR] :  TiApplication:   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
[ERROR] :  TiApplication:   at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] :  TiApplication:   at android.os.Looper.loop(Looper.java:148)
[ERROR] :  TiApplication:   at android.app.ActivityThread.main(ActivityThread.java:5422)
[ERROR] :  TiApplication:   at java.lang.reflect.Method.invoke(Native Method)
[ERROR] :  TiApplication:   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
[ERROR] :  TiApplication:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
[ERROR] :  TiApplication: Caused by: Unexpected CallbackManager, please use the provided Factory.
[ERROR] :  TiApplication:   at com.facebook.login.LoginManager.registerCallback(LoginManager.java:128)
[ERROR] :  TiApplication:   at com.facebook.login.widget.LoginButton.registerCallback(LoginButton.java:445)
[ERROR] :  TiApplication:   at facebook.LoginButtonView.<init>(LoginButtonView.java:40)
[ERROR] :  TiApplication:   at facebook.LoginButtonProxy.createView(LoginButtonProxy.java:34)
[ERROR] :  TiApplication:   at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:492)
[ERROR] :  TiApplication:   at org.a
[ERROR] :  TiApplication:   at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:516)
[ERROR] :  TiApplication:   at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:500)
[ERROR] :  TiApplication:   at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:478)
[ERROR] :  TiApplication:   at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:679)
[ERROR] :  TiApplication:   at org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.java:573)
[ERROR] :  TiApplication:   at ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:253)
[ERROR] :  TiApplication:   at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:33)
[ERROR] :  TiApplication:   at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:524)
[ERROR] :  TiApplication:   at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:638)
[ERROR] :  TiApplication:   at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
[ERROR] :  TiApplication:   at android.app.Activity.performCreate(Activity.java:6251)
[ERROR] :  TiApplication:   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
[ERROR] :  TiApplication:   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
[ERROR] :  TiApplication:   ... 9 more

I used: appcelerator sdk 5.2.1 android sdk 23

2
If you followed this guide then it looks like you've found a bug. Thanks for that! Could you check if this is a known issue at the Appcelerator JIRA. If it's not, please create a ticket, link to this question but also provide reproducible code, steps and environment information in the ticket itself. Don't forget to drop a link to the ticket here so that others can watch it with you.Fokke Zandbergen
Most likely it is a bug in Alloy, since it is working in a classic project. Link to the ticket: AC-3441Marcin
I see (you will soon as well - asked to publish the private comment) it has been reproduced so we'll be fixing it asap. Thanks a lot!Fokke Zandbergen

2 Answers

3
votes

It happened to me and I needed to initialize

var fb = require('facebook');
fb.initialize();
2
votes

i was getting the same problem... In my case, the app was working ok and stop working without any changes...

whatever... I my case, i just found that i need call Alloy.Globals.Facebook.initialize(); before everything else.