Plugin not found, or is not a CDVPlugin. Check your plugin mapping in config.xml

荒凉一梦 提交于 2019-12-03 03:10:01

Here is an small unimportant detail I forgot to mention in the question. This is what the www/config.xml in the sample app using the plugin looked like. Can you spot the issue?

<widget id="org.sample.test" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>My Cordova Test</name>
    <description>
        A series of tests demonstrating the use of my cordova plugin
    </description>
    <author email="" href="">
        That would be me
    </author>
    <content src="index.html" />
    <access origin="*" />
</widget>

Notice the space in the application name <name>My Cordova Test</name>. This seems to work at first, but it puts spaces in the folder name that will later host your plugin. That is enough to interfere with the plugin installation process. This is what I did to fix the issue:

  • changed the name of the test app to MyCordovaTest
  • cordova platform remove ios
  • cordova plugin remove org.myplugin.cordova
  • cordova platform add ios
  • cordova plugin add ../my-plugin
  • cordova build ios

Now the plugin is installed properly and is initialized as expected. Many thanks to the nice folks in #phonegap IRC room who helped me debug this problem. I hope this helps someone.

In my case, when I was facing the same issue in ios the error was that in plugin.xml file of plugin

        <config-file target="config.xml" parent="/*">
            <feature name="UDPSender">
                <param name="ios-package" value="UDPSender"/>
            </feature>
        </config-file>

the value was mismatching with that of present in swift file, in swift file start of class was something like that

@objc(HWPUDPSender) public class UDPSender: CDVPlugin, GCDAsyncUdpSocketDelegate{

here we can see in plugin.xml value is UDPSender but in swift file it is HWPUDPSender and these two should be same

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!