简体   繁体   English

调试Cordova插件

[英]Debug Cordova Plugin

How do you debug the non-js portion of a cordova plugin? 您如何调试cordova插件的非js部分? 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. 我发现了一些关于Stack Overflow的讨论,但是都没有一个关于如何将插件放入IDE并能够断点的答案。

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. 调试JS没问题,而且很有意义,但是我不知道如何从android / ios端打印出日志或命中断点。

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. 我正在对InAppBrowser进行一些小的更改以允许Cookie的读取/写入,而我非常需要了解如何进行监视。

Any help would be vastly appreciated. 任何帮助将不胜感激。

Create a new cordova project 创建一个新的cordova项目

cordova create debugPlugins com.debug.plugis debugPlugins

go to the new folder 转到新文件夹

cd debugPlugins

add ios and android platforms 添加ios和android平台

cordova platform add ios android

and the inAppBrowser plugin (or any other you want to debug) 和inAppBrowser插件(或其他要调试的插件)

cordova plugin add cordova-plugin-inappbrowser

When you added android and ios platforms, two native project where created, you can open and debug them. 添加android和ios平台(创建两个本地项目)时,可以打开和调试它们。

  • For ios, go to platforms/ios and open the debugPlugins.xcodeproj 对于ios,请转到platforms/ios然后打开debugPlugins.xcodeproj
  • For android open android studio, go to File->New->Import Project and select the platforms/android folder 对于android,请打开android studio,转到File-> New-> Import Project并选择platforms/android文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM