Chances are pretty good you’ll need to debug your plugin interactively. To do this easily, you’ll want to build an example app that uses your plugin. For example:

$ cordova create hello com.example.hello hello
$ cd hello
$ cordova platform add --save ios android windows browser
$ cordova plugin add --save /path/to/your/plugin

If you want to see the prime plugin’s example project, it’s available here: https://github.com/kerrishotts/cordova-plugin-example-isprime/tree/master/example

Note: In order to run on Windows 10 as a UWP app, you need to add <preference name="windows-target-version" value="10.0" /> and execute on a version of Windows with Edge 15 or better.

One you have your example project configured, you need to launch your project in your IDE. Make sure to cordova prepare first, but then you should be able to open your project in your desired IDE.

# for iOS (requires a Mac); launches Xcode
$ open platforms/ios/example.xcworkspace

# for Android; launches Android Studio
$ open -a "Android Studio" "./platforms/android/"

# for Windows; launches Visual Studio
> start .\platforms\windows\CordovaApp.sln

You may also need to debug the JavaScript side of things, in which case, you can connect Google Chrome to your Android apps and Safari to your iOS apps. Visual Studio can be used to debug Windows apps.

If you need to make changes to your plugin code, you’ll need to do so in the IDE. Don’t forget to copy those changes back to your plugin project!


Navigation: