Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] : Cannot read property 'authenticate' of undefined #12

Open
GroupeBEL opened this issue Apr 30, 2020 · 4 comments
Open

[Android] : Cannot read property 'authenticate' of undefined #12

GroupeBEL opened this issue Apr 30, 2020 · 4 comments

Comments

@GroupeBEL
Copy link

Hello,

When I run my ionic application in android and I tried to sign in, I got this problem:

Cannot read property 'authenticate' of undefined

I tried to test it with android 10 and android 8.

iOS is showing the authentication.

@pradella
Copy link

Same here. Seems like the plugin is not recognized when Android.
iOS works fine.

@pradella
Copy link

@webteambel found the solution:

When in Android, plugins must be exported:
https://capacitor.ionicframework.com/docs/plugins/android/#export-to-capacitor

Following the link above, import the class:
import com.teamhive.capacitor.plugin.SingleSignOn;

...and add the plugin:
add(SingleSignOn.class);

@Zensynthium
Copy link

What files what you add those lines of code in?

@pradella
Copy link

MainActivity.java

Sharing mine below:

package com.myapp;

import android.os.Bundle;

import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;

import java.util.ArrayList;

// Other imports...
import com.teamhive.capacitor.plugin.SingleSignOn;

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initializes the Bridge
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
      // Additional plugins you've installed go here
      // Ex: add(TotallyAwesomePlugin.class);
      add(SingleSignOn.class);
    }});
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants