Custom android capacitor plugin not found

I am creating the android side of my capacitor plugin for uwb.

for testing purposes its just a shell with methods to call…

plugin build is fine
in plugin project
npm run build
then in app project
npm install path
then npx cap sync
shows installed

✔ Copying web assets from dist to android/app/src/main/assets/public in 21.14ms
✔ Creating capacitor.config.json in android/app/src/main/assets in 956.71μs
✔ copy android in 37.29ms
✔ Updating Android plugins in 2.31ms
[info] Found 5 Capacitor plugins for android:
✔ update android in 55.04ms
[info] Sync finished in 0.094s

because it is a custom plugin, according to the doc i need to explicitly register it in MainActivity

package io.ionic.starter;
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import;  // android studio found this

public class MainActivity extends BridgeActivity {
    public void onCreate(Bundle savedInstanceState) {

and then sync in Android studio and run

but mainActivity crashes

NativePlugin failed to load
              com.getcapacitor.PluginLoadException: Unable to load plugin instance. Ensure plugin is publicly accessible
              at com.getcapacitor.PluginHandle.load(
              at com.getcapacitor.PluginHandle.<init>(
              at com.getcapacitor.Bridge.registerPlugin(Bridg

the plugin top


import android.content.Context
import com.getcapacitor.JSObject
import com.getcapacitor.Plugin
import com.getcapacitor.PluginCall
import com.getcapacitor.PluginMethod
import com.getcapacitor.annotation.CapacitorPlugin
import kotlinx.coroutines.Job
import android.util.Log;

import java.util.Calendar;

import kotlinx.coroutines.flow.*

import kotlin.collections.hashMapOf
import androidx.lifecycle.lifecycleScope

import kotlinx.coroutines.job
import kotlinx.coroutines.launch

@CapacitorPlugin(name = "sduwb")
public final class sduwbPlugin : Plugin() {
    fun createManager(call: PluginCall) {
        val timeKey:String =getMS();
       Log.i("estimoteplugin", "createManager enter $timeKey");
// 3rd party lib calls here
       Log.i("estimoteplugin", "createManager exit $timeKey");
        val ret = JSObject()
        ret.put("handle", timeKey)

maybe its the npm run build in the plugin…

Mac-mini:estimoteplugin sam$ npm run build android

> estimoteplugin@0.0.1 build
> npm run clean && tsc && rollup -c rollup.config.js android

> estimoteplugin@0.0.1 clean
> rimraf ./dist

android → dist/plugin.js, dist/plugin.cjs.js...
[!] Error: Could not resolve entry module (android).
Error: Could not resolve entry module (android).
    at error (/Users/sam/ionic/estimoteplugin/node_modules/rollup/dist/shared/rollup.js:198:30)
    at ModuleLoader.loadEntryModule (/Users/sam/ionic/estimoteplugin/node_modules/rollup/dist/shared/rollup.js:22306:20)
    at async Promise.all (index 0)

Mac-mini:estimoteplugin sam$ 

if I do just npm run build

npm run build

> estimoteplugin@0.0.1 build
> npm run clean && tsc && rollup -c rollup.config.js

> estimoteplugin@0.0.1 clean
> rimraf ./dist

dist/esm/index.js → dist/plugin.js, dist/plugin.cjs.js...
created dist/plugin.js, dist/plugin.cjs.js in 19ms
Mac-mini:estimoteplugin sam$ ls dist
esm			plugin.cjs.js	plugin.js
Mac-mini:estimoteplugin sam$ ls dist/esm
definitions.d.ts	definitions.js	index.d.ts		index.js

then dump the files

Mac-mini:estimoteplugin sam$ find dist

I don’t think there is anything android in there

I started over wih my plugin from npm init…

now it works…

called in and got proper response back…

so, never mind