0

I have a custom cordova plugin that includes both a *.aar file and *.kt (kotlin) files. When I remove and re-add my plugin (it's in the local file system, it fails because the remove step didn't actually remove all of it; here's an example error:

Error during processing of action! Attempting to revert...
Failed to install 'com.rsginc.mobilesurvey': CordovaError: Uh oh!
"/Users/me/code/ms-client-echidna/platforms/android/app/src/main/kotlin/com/rsginc/mobilesurvey/BreadCrumbs.kt" already exists!
    at copyNewFile (/Users/me/code/ms-client-echidna/platforms/android/cordova/lib/pluginHandlers.js:261:45)
    ...

I have a workaround - an alias that will remove the plugin, rm the source, and then reinstall it, but that's ugly to share with other developers in my group.

Here's a line from my plugin.xml (that matches the above error):

<source-file src="src/android/BreadCrumbs.kt" target-dir="app/src/main/kotlin/com/rsginc/mobilesurvey" />

Is there something else I can add to my plugin.xml so it will clean up during the 'cordova plugin rm ...'?

1 Answer 1

0

Currently (as of [email protected]), Cordova only removes .java files when plugins are uninstalled from the Android platform.

You can use --force when re-adding the plugin to ignore the error that occurs because the .kt source files already exist in the android platform project.

Or, if you take a look at my cordova-plugin-hello-kotlin example plugin, you can add the uninstall hook script to your plugin which removes any .kt specified in the plugin.xml from the android platform project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.