简体   繁体   中英

Capacitor Plugins don't work on Android version

在此处输入图像描述

Hello i am trying to build my capacitor 3 project. It works on iOS just fine but in Android version i am getting errors for all the plugins i am using (like the one on image -Google Sign in) except from the 2 i am declaring on MainActivity.java (FACEBOOK AND FCM).

MainActivity.java

package com.myproject.mobile;
import android.os.Bundle; 
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;
import com.getcapacitor.community.fcm.FCMPlugin;
import java.util.ArrayList;

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
        **add(com.getcapacitor.community.facebooklogin.FacebookLogin.class);
        add(com.getcapacitor.community.fcm.FCMPlugin.class);**
      }});
    }
}

I am getting a problem report on Visual Studio

"message": "MainActivity.java is not on the classpath of project app, only syntax errors are reported",

Do i have to declare all the plugins on MainActivity.java? It seems kind of off that's why i am asking.

Plus, the splashscreen jpg works but i am getting the capacitor icon as an app icon.

Any hint?

Try to migrate to Capacitor version 4: Here's the official guide

I was working on google sign-in for so long with capacitor when one day, all of sudden, got multiple errors on Android. What I did notice is that capacitor was just been updated to version 4 and some Android variables needed to change. After I did the upgrade, those error went away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM