'How to build custom Capacitor 3 plugin and access Java class from another plugin in node_modules
I am building a custom capacitor plugin with:
npm init @capacitor/plugin
This creates my plugin but following the directions it says to run:
npx cap sync
But I get this error: npm ERR! could not determine executable to run
I'm just adding this info as I'm not sure if it affects anything...
So I created my Java class in Android studio (AS) to extend capacitor-push-notifications. All this works in AS but I wanted to create a plugin so if something happens to the android folder I can rely on my plugin to add the Java files.
I import the file (in Java):
import com.capacitorjs.plugins.pushnotifications.PushNotificationsPlugin
My question is: How do I import the capacitor-push-notifications when I am in VS Code? I get the following error when I run npm run verify:android:
Could not find com.capacitorjs.plugins.pushnotifications:pushnotifications:1.0.9.
Required by:
project :
also, I did install the plugin:
npm i @capacitor/push-notifications
also added this to build.gradle under dependancies:
implementation "com.capacitorjs.plugins.pushnotifications:pushnotifications:1.0.9"
So do I just ignore the error as I know it works in AS? I looked everywhere and cannot find any reference to this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
