android – Having issue in creating cordova plugin and also having problem in importing it in ionic cordova project


I want to create a cordova plugin in my local system but having issue while importing and installing it in my ionic cordova project, i am having error while trying to import the cordova plugin in ionic cordova project, so i want a solution that how i create a cordova project in my local system first then after testing will to publish it.
I am using below versions-
ionic -v
7.2.0
cordova -v
12.0.0 ([email protected])
npm -v
10.2.3
node -v
v18.19.0
nvm -v
1.1.11

Error –
Error:
Build at: 2024-01-29T14:45:00.196Z – Hash: 4798c2666d0154ce – Time: 1087ms
Error: src/app/home/home.page.ts:25:29 – error TS2307: Cannot find module ‘io.electrosoft.helloworld’ or its corresponding type declarations.
25 import HelloTestPlugin from ‘io.electrosoft.helloworld’;
import { HelloTestPlugin } from ‘io.electrosoft.helloworld’;
× Failed to compile.

Getting error in both ways, while importing the plugin.

I am having below files and folders in my cordova plugin
HelloTestPlugin\plugin.xml
HelloTestPlugin\src
HelloTestPlugin\src\android
HelloTestPlugin\src\android\HelloTestPlugin.java
plugin\HelloTestPlugin\www
HelloTestPlugin\www\HelloTestPlugin.js
HelloTestPlugin\package.json

I tried creating cordova plugin having below files in my cordova plugin –
HelloTestPlugin\plugin.xml
HelloTestPlugin\src
HelloTestPlugin\src\android
HelloTestPlugin\src\android\HelloTestPlugin.java
plugin\HelloTestPlugin\www
HelloTestPlugin\www\HelloTestPlugin.js
HelloTestPlugin\package.json

But not able to access and import this in my ionic cordova proejct.

I want to create a cordova plugin in my local system and after testing it then i want to publish it, I want to import that cordova project in my ionic cordova project for both android and ios platform.

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img