SAP UI5 Custom Cordova plugin的調試方法
小編:管理員 360閱讀 2022.09.13
I will continue to use the UI5 application Step by step to create a custom Cordova plugin for Android and consume it in your UI5 application described in my previous blog for demo.How to debug UI5 code running in Android device
Suppose you would like to debug whether your UI5 code runs correctly in a real Android device. The steps to debug in Chrome is almost the same as when you debug the UI5 application running in PC, only a few additional steps are necessary.
(1) Enable USB debug option for your Android device. And then connect your mobile device with your PC, open Chrome development tool:
Now your should see your Android device here:
(2) Launch the UI5 application in your mobile device, then you should find a new entry appears under your device name. Click button “Inspect”:
There is nothing new starting from here: you could just set breakpoint in whatever positions. For example, in the screenshot below I set a breakpoint in line 38, where the plugin written in Java is to be called.
(4) Re-launch the application, and now breakpoint is triggered. Press F11, and we can still step into and check how Cordova plugin written by Java is called:
I am using Android development studio to debug the Java code.
Suppose the root folder of my project is JerryUI5HelloWorld, just open the folder android under platforms folder, as highlighted below.
Once the project is opened via Android studio, it looks like as below:
Launch the application under debug mode:
Repeat the operation in UI, and the breakpoint set previously is triggered now.
You can still switch between different callstack frame to observe how the custom plugin is called by Cordova framework in Java side.
- Cordova 什么是Cordova？ Cordova是用于使用HTML，CSS和JS構建移動應用的平臺。我們可以認為Cordova是一個容器，用于將我們的網絡應用程序與本機移動功能連接。默認情況下，Web應用程序不能使用本機移動功能。這就是Cordova進來的地方。它為網絡應用和移動設備之間的連…
- Hibernate Criterion 在查詢方法設計上能夠靈活的依據Criteria的特點來方便地進行查詢條件的組裝.Hibernate設計了CriteriaSpecification作為Criteria的父接口,以下提供了Criteria和DetachedCriteria.Criteria和DetachedCriteria的主要差別在于創建的形式不一樣,Criteria是在線的,所…