facebookarchive / account-kit-samples-for-android

Account kit sample for the android platform
Other
123 stars 96 forks source link

The SDK has not been initialized, make sure to call AccountKit.initialize() first #9

Closed nikosurya closed 5 years ago

nikosurya commented 7 years ago

the title is the error i got. i already tried to use another post answer but i still get the error. can anyone explain why this error happened and how to solve it. is it AccountKit.initialize already desperate?

lepouya commented 7 years ago

Can you give more details? What method call caused this error? How is AK setup on your project?

nikosurya commented 7 years ago

i got this error in if (AccountKit.getCurrentAccessToken() != null)

lepouya commented 7 years ago

This seems like an issue with your AndroidManifest.xml file then. When the manifests are being merged, we put a provider in your application called "${applicationId}.AccountKitInitialization" Few suggestions for what to check:

  1. Check that you're not overriding or deleting the default $applicationId in the manifest
  2. Make sure the manifests are being merged with no conflicts. Gradle and Android Studio always do it by default, but you might be using a custom build?
  3. Is there a chance that the manifest is not loaded? For example in unit tests you may not be doing the @RunWith
  4. Are you calling AccountKit.getCurrentAccessToken from the UI thread? Do you have multiple processes in your app?
nikosurya commented 7 years ago

how can i check $applicationId. is it in ? i think the manifest is doing okay with the merged, no error found. and yes i am calling AccountKit.getCurrentAccessToken from the UI thread and have multiple processes in my app.

if i remove the accountKit.get.... the app can run but appears the same error somewhere.

zaren678 commented 7 years ago

@nikosurya Are you using Accountkit from the main process or a secondary process? If you have multiple processes you'll need to initialize Accountkit manually from the second process.