Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capacitor v3 plugins not working on android build

I'm using capacitor v3 beta and there are no problem working in web and iOS but can't run android app. Build is done fine but when running the app appears this error:

E/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 41296 - Msg: ERROR Error: Uncaught (in promise): Error: "Storage" plugin is not implemented on android
    Error: "Storage" plugin is not implemented on android

To solve this error I've removed the storage plugin and replaced with ionic/storage plugin. But when I use other plugin, for example the Keyboard, the error shows up saying that Keyboard plugin is not implemented on android.

So I suppose that there is some problem with Android builds or project configuration.

These are de node dependencies in my package.json

"@capacitor/android": "^3.0.0-beta.6",
"@capacitor/core": "^3.0.0-beta.1",
"@capacitor/storage": "^0.3.1",

And my capacitor.config.json file

{
    "appId": "net.flowww.me",
    "appName": "FLOWwwMe",
    "bundledWebRuntime": false,
    "npmClient": "npm",
    "webDir": "www",
    "cordova": {}
}

iOS version works well with this configuration.

like image 954
legomolina Avatar asked Mar 04 '21 15:03

legomolina


People also ask

How do I import plugins into capacitor core?

import { Plugins } from '@capacitor/core'; import { MyImport } = Plugins; If that is the question you're asking, then Capacitor 3 now uses modulated plugins so they're all independent of each other. You now import them directly, e.g: import { Storage } from '@capacitor/storage';


Video Answer


1 Answers

Storage plugin not worked after Ionic v3 upgrades from v2. It work after manually adding a plugin to MainActivity.java for me:

package com.ionic.app;

import android.os.Bundle;

import com.getcapacitor.BridgeActivity;
import com.capacitorjs.plugins.storage.StoragePlugin;

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

    registerPlugin(StoragePlugin.class);
  }
}
like image 103
Erk Avatar answered Sep 18 '22 14:09

Erk