使用Facebook帐户套件时出现此错误。当我调试程序时,方法Accountkit.GetCurrentAccessToken()!=null
会导致此错误。
当我删除这个。然后在某处但不在我编写的代码中也会导致此错误。我已经尝试过编辑manifest.xml但我没有运气。
任何人都可以帮我解决这个问题吗?
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.featuring.beta.featuringbeta, PID: 26749
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.featuring.beta.featuringbeta/com.facebook.accountkit.ui.AccountKitActivity}: 500: Initialization error: 501: The SDK has not been initialized, make sure to call AccountKit.initialize() first
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2330)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5261)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:939)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:734)
Caused by: 500: Initialization error: 501: The SDK has not been initialized, make sure to call AccountKit.initialize() first
at com.facebook.accountkit.internal.Validate.sdkInitialized(Validate.java:53)
at com.facebook.accountkit.internal.Initializer.getLoginManager(Initializer.java:199)
感谢。
注意我使用Accountkit创建了一个新项目,它工作正常。当我将代码放入我的项目进行注册和登录时,会导致此错误。
答案 0 :(得分:0)
确保您在应用程序类中初始化帐户工具包,如此
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
AccountKit.initialize(getApplicationContext());
}
}
之后在Manifest中
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.you.yourapp">
<application
android:name=".MyApplication"