Search code examples
javascriptandroidioscordovacordova-plugins

Debug Cordova Plugin


How do you debug the non-js portion of a cordova plugin? I have found several discussions on Stack Overflow, but none of them have given me an answer on how I throw my plugin into an IDE, and be able to breakpoint it.

Debugging the JS is no problem and makes sense, but I have no idea how to either print out a log from the android/ios side or hit breakpoints.

I am in the process of making a small change to InAppBrowser to allow Cookie read/writing and I desperately need to know how to monitor this.

Any help would be vastly appreciated.


Solution

  • Create a new cordova project

    cordova create debugPlugins com.debug.plugis debugPlugins
    

    go to the new folder

    cd debugPlugins
    

    add ios and android platforms

    cordova platform add ios android
    

    and the inAppBrowser plugin (or any other you want to debug)

    cordova plugin add cordova-plugin-inappbrowser
    

    When you added android and ios platforms, two native project where created, you can open and debug them.

    • For ios, go to platforms/ios and open the debugPlugins.xcodeproj
    • For android open android studio, go to File->New->Import Project and select the platforms/android folder