Skip to content
This repository has been archived by the owner. It is now read-only.

The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first. #64

Closed
mishrasatyam opened this issue Aug 24, 2021 · 10 comments · Fixed by #84
Closed
Assignees
Labels
bug/fix Something isn't working platform: android Android platform

Comments

@mishrasatyam
Copy link

Current behavior:
I just installed @robingenz/capacitor-firebase-authentication@0.3.6 . I did not use it in the code and after sync with capacitor I get "The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first. "

Expected behavior:
Above behaviour should not happen . This is happening when I haven't even imported anything from the package yet.

Capacitor doctor:

   Capacitor Doctor   

Latest Dependencies:

  @capacitor/cli: 3.2.0
  @capacitor/core: 3.2.0
  @capacitor/android: 3.2.0
  @capacitor/ios: 3.2.0

Installed Dependencies:

  @capacitor/ios: not installed
  @capacitor/core: 3.2.0
  @capacitor/cli: 3.2.0
  @capacitor/android: 3.2.0

[success] Android looking great! 👌
@robingenz
Copy link
Owner

Hi @mishrasatyam,
I tried to reproduce the problem, but unfortunately I did not get it.
I do not receive any error message after sync.
Can you please provide me a Minimal, Reproducible Example (see here) and the exact steps?

@pradeepmdk
Copy link

@mishrasatyam add below in MainActivity.java
public class MainActivity extends BridgeActivity {
@OverRide
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(getApplicationContext());
}
}

@robingenz
Copy link
Owner

This should not be necessary.
If you provide a minimal, reproducible example, I will try to fix the problem.

@mishrasatyam
Copy link
Author

Hey , I have created a repo . Please check . Thanks.

@robingenz
Copy link
Owner

@mishrasatyam Please follow the installation instructions correctly (see here):

  1. android/app/src/main/res/values/strings.xml does not contain the required configuration values
  2. android/app/src/main/AndroidManifest.xml does not contain the required configuration values

Also see Before you begin and follow the instructions to configure sign-in with Facebook correctly.

Please update your example and check if the problem still exists.

@robingenz
Copy link
Owner

Oh sorry, you didn't mean to use Facebook did you? You just installed the plugin. So the setup is correct.
I tried to reproduce the issue with your repo but get the following error messages:

$ npx cap sync android
[error] Could not find installation of TypeScript.
        To use capacitor.config.ts files, you must install TypeScript in your project, e.g. w/ npm install -D typescript

$ npm install -D typescript

added 1 package, and audited 209 packages in 2s

13 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

$ npx cap sync android
[error] Could not find the web assets directory: .\build.
        Please create it and make sure it has an index.html file. You can change the path of this directory in
        capacitor.config.ts (webDir option). You may need to compile the web assets for your app (typically npm run
        build). More info: https://capacitorjs.com/docs/basics/workflow#sync-your-project

It seems that the project is not yet configured correctly.

I have created my own test project:

npx ionic start
npx ionic build
npm install @robingenz/capacitor-firebase-authentication firebase
npx ionic cap add android

I get the following output after running npx cap sync:

√ Copying web assets from www to android\app\src\main\assets\public in 1.67s
√ Creating capacitor.config.json in android\app\src\main\assets in 1.66ms
√ copy android in 1.72s
√ Updating Android plugins in 8.56ms
[info] Found 4 Capacitor plugins for android:
       @capacitor/app@1.0.3
       @capacitor/haptics@1.0.3
       @capacitor/keyboard@1.0.3
       @robingenz/capacitor-firebase-authentication@0.3.9
√ update android in 104.04ms
√ copy web in 1.10ms
√ update web in 979.90μp
[info] Sync finished in 1.83s

So everything is fine. I still can't reproduce it.

Do you have any more information for me? What are the exact steps you take?

@mishrasatyam
Copy link
Author

Hey, just do npm install and npm run android in the repo i linked. It will build and open android studio. You can see error when you try to run on a Device

@robingenz
Copy link
Owner

I was able to reproduce it and will take a closer look the next few days. Thank you!

@robingenz
Copy link
Owner

As a temporary workaround, the Facebook provider should be disabled (if it is not needed) via the providers configuration option.
I will publish a fix today.

@robingenz
Copy link
Owner

robingenz commented Sep 8, 2021

The message appears because the Facebook SDK does not find the required configurations.
The SDK is required for this plugin to provide Facebook sign-in functionality.
The message now no longer causes the app to crash.
The fix will be included in version 0.3.10.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/fix Something isn't working platform: android Android platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants