WO2018108041A1 - 一种远程调试方法及装置、计算机存储介质 - Google Patents

一种远程调试方法及装置、计算机存储介质 Download PDF

Info

Publication number
WO2018108041A1
WO2018108041A1 PCT/CN2017/115342 CN2017115342W WO2018108041A1 WO 2018108041 A1 WO2018108041 A1 WO 2018108041A1 CN 2017115342 W CN2017115342 W CN 2017115342W WO 2018108041 A1 WO2018108041 A1 WO 2018108041A1
Authority
WO
WIPO (PCT)
Prior art keywords
debugging
kernel
debug
view
target
Prior art date
Application number
PCT/CN2017/115342
Other languages
English (en)
French (fr)
Inventor
郑清江
黄明虎
李庆美
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2018108041A1 publication Critical patent/WO2018108041A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a remote debugging method and apparatus, and a computer storage medium.
  • the so-called Remote Debugging is to debug an application running on a remote B machine through a debugging client running on the A machine, for example, through a debugging client running on a Personal Computer (PC). Debug an application running on a mobile terminal such as a smartphone.
  • PC Personal Computer
  • One debugging method provided in the prior art is to use the Google Developer Tools (Chrome Dev Tools) to debug applications on the mobile terminal.
  • Google Developer Tools Chorome Dev Tools
  • a Google browser needs to be installed on a mobile terminal such as a smart phone and a PC, and only a Google browser can be used to access the page during debugging. That is to say, during the debugging process, the display and rendering of the web view (ie webview page) is implemented by Google Chrome, and the webpage view can be loaded by using the webkit kernel; In the application, not all webpage views access the webpage through Google Chrome, which makes it impossible to actually restore the actual running scenario of the application on the mobile terminal during the debugging process.
  • Google Developer Tools Chorome Dev Tools
  • the display and rendering of the web view under Google Chrome The effect and problem of the web page view are different or different from the running effects and problems in the corresponding application on the mobile terminal.
  • the debugged application and the corresponding web page view cannot be truly restored.
  • the real host environment makes it difficult for developers to locate problems quickly and accurately during development and debugging.
  • the method for remote debugging in the prior art cannot accurately accurately locate the problem because the real operating environment of the application on the mobile terminal cannot be truly restored.
  • the debug data is debugged via a desktop debugging tool sent to the debug host via the ADB connection.
  • the ADB connection establishment module establishes an ADB connection with the debug host
  • the target application determining module receives the ADB detection instruction, and determines the target application to be debugged according to the ADB detection instruction;
  • the webview debug kernel installation module downloads and installs a preset target web view debug kernel, and the target web view debug kernel includes a webkit kernel for parsing webpage elements;
  • Debugging the data sending module parsing the webpage view displayed in the target application, and sending, by the target webpage view debugging kernel, debugging data of the webpage view displayed in the target application to the debugging via the ADB connection
  • the host's desktop debugging tool is debugged.
  • the webpage view debugging kernel includes a webkit kernel for parsing webpage elements, and the webpage view debugging kernel parses the webpage displayed in the webpage view of the target application;
  • the ADB connection establishment module establishes an ADB connection with the debug host
  • the ADB detects an instruction sending module, and sends an ADB detection command to the debug host, so that the debug host determines a target application running on the mobile phone, and the debug host is further configured to install a preset on the mobile phone.
  • a target web page view debugging kernel the target web page view debugging kernel includes a webkit kernel for parsing webpage elements, and the kernel is debugged by the webpage view Parsing the web page displayed in the web view of the target application;
  • the debugging module receives debug data of the webpage view displayed in the target application through the target webpage view debugging kernel sent by the debug host via the ADB connection, and debugs the received debug data.
  • the debug host receives an ADB detection instruction, and determines a target application to be debugged according to the ADB detection instruction;
  • the debug host downloads and installs a preset target webpage view debug kernel, and the target webpage view debug kernel includes a webkit kernel that parses webpage elements;
  • the debug host opens a debug switch of the target application by using the target web page view debug kernel, parses a webpage view displayed in the target application, and debugs the target application by using the target webpage view debug kernel
  • the debug data of the web page view shown in the above is debugged by the desktop debugging tool sent to the debug host via the ADB connection.
  • the debug host establishes an ADB connection with the debug host
  • the debug host sends an ADB detection command to the debug host, so that the debug host determines a target application running on the mobile phone, and the debug host is further configured to install a preset target webpage on the mobile phone.
  • a view debugging kernel the target web page view debugging kernel includes a webkit kernel for parsing webpage elements, and the webpage view debugging kernel is used to parse the webpage displayed in the webpage view of the target application;
  • the debug host receives debugging data of the webpage view displayed in the target application by the debug host via the target webpage view debugging kernel sent by the debug host, and debugs the received debug data.
  • the computer storage medium of the embodiment of the present application where computer executable instructions are stored,
  • the remote debugging method described above is implemented when the computer executable instructions are executed by the processor.
  • an ADB connection is established between the debug host and the debug host, and the target application to be debugged on the debug host is determined by the ADB instruction, and then downloaded and installed on the debug host.
  • the preset web page view debugging kernel of the webkit kernel is included, and then the debugging function of the target application is started by the web page view debugging kernel, so that the debugging host desktop debugging tool can display the webpage displayed on the target application of the debugging host.
  • the view is debugged.
  • the debugging of the target application is triggered by installing the webpage view debugging kernel, so that all applications that implement the debugging interface corresponding to the webpage view debugging kernel can be debugged by debugging the host desktop debugging tool; Because the target application is an application that implements the debugging interface corresponding to the web page view debugging kernel, it is implemented by the web page view debugging kernel in the process of parsing and displaying the web page view, and the remote debugging is performed through the above.
  • the display of the web page view is also implemented by the web page view debugging kernel, which makes the real running environment of the debug web page view in the actual use process consistent with the host environment in the debugging process, to the maximum extent.
  • the real running environment of the web page view is restored, so that the developer can accurately locate the problems in the process of debugging and improve the efficiency.
  • FIG. 1 is a schematic diagram of the composition of a remote debugging system in an embodiment
  • FIG. 2 is a schematic diagram of an interface of a desktop debugging tool on a debugging host in an embodiment
  • FIG. 3 is a schematic diagram of interaction of a remote debugging process in an embodiment
  • FIG. 4 is a schematic flow chart of a remote debugging method running on a debugging host in an embodiment
  • FIG. 5 is a schematic flow chart of a remote debugging method running on a debug host in an embodiment
  • FIG. 6 is a schematic diagram of an interface of a confirmation page of a target application of an embodiment
  • FIG. 7 is a schematic diagram of an interface of a confirmation page for opening a debug switch of an embodiment
  • FIG. 8 is a schematic flow chart of a remote debugging method in an embodiment
  • FIG. 9 is a schematic diagram of interaction of interactions between components of a remote debugging process in an embodiment
  • FIG. 10 is a schematic structural diagram of a remote debugging device based on a debugging host in an embodiment
  • FIG. 11 is a schematic structural diagram of a remote debugging device based on a debug host in an embodiment
  • FIG. 12 is a schematic structural diagram of a computer system running the above remote debugging method in an embodiment.
  • FIG. 1 shows a structural diagram of a remote debugging system, in an embodiment.
  • the remote debugging system includes a debug host and a debug host.
  • the debugging host may be a computer device with a debugging tool installed, for example, a personal computer (PC) with a desktop debugging tool installed, or a server, a multi-processor system, a small computer, or a debugging tool.
  • a computer and a computer device such as a distributed computing environment including any of the above systems or devices.
  • the debug host is a target machine for debugging, such as a smartphone, a tablet or other mobile terminal device.
  • the desktop debugging tool installed on the debugging host may be TBS Studio (TBS, ie Tencent Browsing Service, Chinese: Tencent browsing service, TBS Studio is TBS desktop debugging tool), and the user can download in the corresponding The website downloads the API file corresponding to the TBS desktop debugging tool, and the desktop debugging tool does not need to be installed on the debugging host to run and debug the program on the corresponding APP on the debugging host connected to the debugging host.
  • TBS Studio The user interface of the Desktop Debugging Tool (TBS Studio) on the debug host is shown in Figure 2.
  • FIG. 3 shows an interaction process between the debugging host and the debugging host of the remote debugging mechanism, as shown in FIG.
  • the process of debugging the host interaction includes:
  • the debug host sends an ADB connection request to the debug host to establish an ADB connection with the debug host.
  • the debug host generates an ADB command (also referred to as an ADB test command).
  • Debug host generation sends the ADB command to the debug host.
  • the debug host determines the target APP running on the mobile phone according to the ADB command.
  • the debug host sends the determined target APP to the debug host.
  • the debug host sends debug data of the web page view to the debug host.
  • the debug host receives the debug data and debugs the received debug data.
  • the mechanism of this embodiment includes a remote debugging method running on the debugging host 10 and a remote debugging method running on the debugging host 20.
  • FIGS. 4 and 5 illustrates a remote debugging method running on the debug host 10
  • FIG. 5 illustrates a remote debugging method running on the debug host 20.
  • FIG. 4 is a schematic flowchart of a remote debugging method running on a debugging host according to an embodiment of the present invention. As shown in FIG. 4, the method includes:
  • Step S102 Detecting a debug host connected to the USB port, and establishing an ADB connection with the debug host via USB.
  • Step S104 Send an ADB detection instruction to the debug host, so that the debug host determines a target application running on the mobile phone.
  • Step S106 Receive debug data of the webpage view displayed in the target application by using the target webpage view debugging kernel sent by the debug host via the ADB connection, and debug the received debug data.
  • connection between the debug host and the debug host may be through a USB (Universal Serial Bus) data line, or may be connected by other means, for example, through a WIFI connection.
  • USB Universal Serial Bus
  • WIFI Wireless Fidelity
  • the target application to be debugged running on the debug host determines the target application to be debugged running on the debug host, and then install the corresponding debug kernel on the debug host to enable the web view space of the target application on the debug host (ie, the webview control, used in the Android system)
  • the webview control used in the Android system
  • Step S202 Establish an ADB connection with the debug host.
  • connection between the debug host and the debug host may be established through USB or may be established through WIFI.
  • a HyperTerminal is installed on the Android device corresponding to the debug host, and the code of the corresponding ADB connection is run in the terminal, and then the debug host is opened.
  • Cmd command line enter: adb connect android device IP address, you can establish an ADB connection between the debug host and the debug host.
  • the step of establishing an ADB connection with the debug host is specifically: the debug host detects the debug host connected to the USB port, and establishes an ADB connection with the debug host through the USB.
  • the communication connection between the debug host and the debug host can be established through the USB port, that is, after the debug host and the debug host are connected by using the USB data cable, the debug host passes the corresponding
  • the USB port detects the corresponding USB connection, and detects the debug host connected to the debug host via the USB data cable, and debugs the USB port on the host and the USB data cable connecting the two by debugging the USB port on the host. , establish a communication connection with the debug host of the connection.
  • the communication connection between the debug host and the debug host is an ADB connection.
  • ADB the Android Debug Bridge
  • the ADB connection between the debug host and the debug host establishes a communication connection between the ADB in the debug host and the debug tool on the debug host, so that the debug host can send the corresponding ADB instruction to the debug host.
  • the debug host can send an ADB instruction to the debug host to debug the debug host.
  • the ADB instruction sent by the debug host to the debug host includes adb devices, adb uninstall ⁇ software name>, etc.
  • the functions that can be implemented by the ADB instruction include running a shell (command line) on the Android device, and managing the simulator. Or port mapping of the device, uploading/downloading files between the computer and the device, installing the local APK software on the computer to the Android emulator or device, etc.
  • Step S204 Receive an ADB detection instruction, and determine a target application to be debugged according to the ADB detection instruction.
  • the debug host when it is necessary to determine the application currently running on the debug host, the debug host can send the ADB instruction to the debug host to implement.
  • the debug host sends an ADB detection command to the debug host to determine an application running on the debug host, and the application running on the debug host is the currently debugged target application to be debugged.
  • the target application to be debugged may be an application currently running on the debug host; for example, when the debug host is a smart phone, if the display is currently displayed on the mobile phone The operation page is the operation page corresponding to "WeChat”, and the target application currently running on the mobile phone is "WeChat”, which is the target application to be debugged.
  • the developer needs to manually select the application to be debugged. And setting the selected application as the target application to be debugged according to the user's selection operation, or re-receiving the ADB detection instruction sent by the debugging host to re-determine the target application.
  • the debugging host when the debugging host is a smart phone, if the operation page currently displayed on the display screen of the mobile phone is an operation page corresponding to “QQ music”, the target application currently running on the mobile phone is "QQ music”.
  • the ADB detection command determines that the application currently running on the display interface of the mobile phone is "QQ Music” and displays the prompt window as shown in FIG. 6, the developer determines that "QQ Music” is currently required to be debugged.
  • the application that is, click the "confirm” button, so that "QQ Music” is the target application for the current debugging; further, if the developer determines that "QQ Music” is not the application that currently needs to be debugged, then for the display
  • the prompt window inputs an instruction corresponding to the button “cancel”, and manually switches to an operation page corresponding to the application to be debugged on the mobile phone, so that the PC determines to be detected when determining the target application to be detected again through the ADB instruction.
  • Target application that is, click the "confirm” button
  • Step S206 Download and install a preset target webpage view debugging kernel, where the target webpage view debugging kernel includes a webkit kernel for parsing webpage elements.
  • the webkit kernel is a browser kernel.
  • the rendering of the page in the browser on the terminal and the rendering of the web view (webview page) in the application need to be performed through the browser kernel.
  • the system kernel is used by default to render the web page view.
  • the rendering of the web view needs to use the kernel to parse the webpage element.
  • the system kernel does not support remote debugging.
  • the webkit kernel built into Google Chrome is used to parse the web view. That is, all web page views are rendered based on Google Chrome.
  • most of the applications are not developed based on Google Chrome, that is, the rendering of the web view is not done by Google Chrome.
  • the web page view debugging kernel is a webkit kernel containing the parsing webpage elements, and the kernel developed based on the wekit kernel is instant.
  • the webpage view debugging kernel inherits all the functions of the webkit kernel.
  • the above web page view debugging kernel can It is the TBS kernel, which is a kernel developed based on the webkit kernel in Tencent's browsing service.
  • the downloading and installing the preset target webpage view debugging kernel further includes: determining whether the target application implements a debugging interface corresponding to the target webpage view debugging kernel, and if so, performing the downloading And install the default target page view debug kernel.
  • the desktop debugging tool on the debugging host cannot be used for debugging, that is, it is not applicable to the embodiment of the present application.
  • the debugging method if the application implements the debugging interface corresponding to the target web view debugging kernel, it can be debugged using the desktop debugging tool on the debugging host.
  • the application For an application that implements the debugging interface corresponding to the web page view debugging kernel, there are mainly two cases. One is that the application itself has a built-in web page view debugging kernel, and the built-in web page view is used when loading the web page view.
  • the debugging kernel is loaded; secondly, the application itself does not have a built-in web page view debugging kernel, but in the process of loading the web page view, the web page view debugging kernel built in other applications in the terminal is called.
  • the display of the web page view is implemented by the web page view debugging kernel.
  • the application installed in the debug host includes an application that accesses the TBS kernel, such as QQ, QQ music, Jingdong Mall, etc.
  • the way to access the TBS kernel for different applications exists.
  • the application has a built-in TBS kernel, that is, the TBS kernel is silently downloaded and installed after the application is installed, or the application accesses, for example, the TBS kernel, Instead of silently downloading the TBS kernel after installing the application successfully, look for the application that has the built-in TBS kernel installed in the terminal and use the TBS kernel when accessing the page. If the TBS kernel is not found, download it yourself. And install the TBS kernel; for the above two cases, at the terminal The TBS kernel has been downloaded and installed.
  • the preset target webpage view debugging kernel needs to be downloaded and installed on the debug host, and the target webpage view debugging kernel may be previously Downloaded and installed, or downloaded and installed after determining the target application to be tested, depending on whether the target application to be debugged has built-in target web view debugging kernel or has access to other applications in the terminal.
  • the target page view debug kernel downloaded and installed in the program.
  • the method before the downloading and installing the preset target webpage view debugging kernel, the method further includes: determining whether the target application includes the installed webpage view debugging kernel; The target application includes the installed webpage view debugging kernel, and the installed webpage view debugging kernel is obtained as a target webpage view debugging kernel, and the debugging of the target application is started by the webpage view debugging kernel. If the target application does not include the installed web page view debug kernel, execute the download and install a preset web view debug kernel.
  • the TBS kernel is silently downloaded and installed, that is, in step S206, there is no need to download again. And install the TBS kernel.
  • an application such as QQ music, Drip Trip, Jingdong Mall, such as a TBS kernel
  • the application searches for a WeChat, QQ, etc. application with the built-in TBS kernel in the mobile phone.
  • the program if it should be installed, calls the found TBS kernel to access the web page view, that is, its TBS kernel is used by sharing the TBS kernel built in other applications with a built-in TBS kernel; for this case, in step S206 There is no need to download and install the TBS kernel again. Further, if in the above step of searching for the WeChat, QQ, and the like in the mobile phone, if the application is not found, the step S206 is required to download and install the preset target. Web view debug kernel.
  • the method further includes: determining, when the target application includes the installed webpage view debugging kernel, the installed webpage view The version number corresponding to the debugging kernel is not lower than the version number corresponding to the target web page view debugging kernel; when the version number corresponding to the installed web page view debugging kernel is not lower than the version number corresponding to the target web page view debugging kernel Obtaining the installed web page view debug kernel as the target web page view debug kernel, and executing the step of enabling the debug switch of the target application by using the target web page view debug kernel; and the installed webpage When the version number corresponding to the view debugging kernel is lower than the version number corresponding to the target web page view debugging kernel, the downloading is performed and the preset target web page view debugging kernel is installed.
  • the web page view debugging kernel included in the target application may be downloaded and installed before the current latest version is released, so it may not be the latest. version of.
  • the step of debugging the host machine to download the target web page view debugging kernel may also be performed by downloading and installing a debugging tool client corresponding to the desktop debugging tool on the debugging host, that is, downloading and During the installation of the above debug tool client, because the web view debug kernel is built into the debug tool client, the target web view debug kernel is also downloaded and installed.
  • the desktop debugging tool on the debug host is TBS Studio
  • the client corresponding to TBS Studio, TBS Studio Client is downloaded and installed on the debug host, and the TBS Studio Client is installed.
  • the debug kernel Proxy application As a debug kernel Proxy application.
  • Step S208 The debugging of the target application is started by the target webpage view debugging kernel, parsing the webview webpage displayed in the target application, and displaying the target application by using the target webpage view debugging kernel.
  • the debug data of the webview webpage is debugged by the desktop debugging tool sent to the debug host via the ADB connection.
  • the debug state is not the normal state of the debug host. That is to say, by default, the debug switch is not enabled by default when debugging the application installed in the host, and debugging is not possible.
  • the debugging switch of the target application is queried by the target web page view debugging kernel.
  • the confirmation page for turning on the debug switch is displayed, and the developer can use this confirmation page to determine the debug switch to turn on the target application.
  • the debug switch can be turned on by accessing debugx5.qq.com. In another embodiment, the debug switch is turned on by the TBS Studio Client when the debug host downloads and installs the TBS Studio Client.
  • the web page view displayed in the target application on the debug host can be debugged on the debug host, that is, the web page that the host machine will display through the ADB connection with the debug host. View-related data is sent to the desktop debugging tool on the debug host for debugging.
  • the target webpage view debugging kernel when the webview webpage is displayed by the target application on the debug host, the target webpage view debugging kernel needs to be called to parse the code corresponding to the webview webpage to display the webview webpage, and therefore, the target is detected.
  • the webpage view debugging kernel is invoked, the debugging data of the webview webpage displayed in the target application is sent to the desktop debugging tool of the debugging host via the ADB connection for debugging by using the target webpage view debugging kernel. step.
  • the target application includes the web page view debugging kernel, it is not required Downloading the target page view debugging kernel, however, because the debugging of the target application is required to be turned on, in this embodiment, the debugging switch can be opened and downloaded by the debugging host.
  • the debugging work client (such as TBS Studio Client) is completed.
  • the opening of the debug switch can also be accomplished by other means, for example, by scanning the two-dimensional code to start the opening of the debug switch.
  • the method further includes: corresponding to the target webpage view debugging kernel being implemented in the target application Debugging the interface, determining whether the target application includes a scan code open page function, and if so, opening an operation page opened with a debug switch of the target application by scanning a two-dimensional code, and obtaining an input through the operation page
  • the confirmation command starts the debugging of the target application according to the confirmation instruction.
  • the application “WeChat”, it supports scanning a QR code to open a webpage or other page; in this embodiment, after determining that the target webpage view debugging kernel is installed in the debug host, it is generated on the debug host.
  • the two-dimensional code corresponding to the debugging switch is enabled, and the developer can scan the two-dimensional code on the debugging host by debugging the target application of the host machine to enter the operation page corresponding to the debugging switch of the target application, and the operation page can be
  • the confirmation page of the debug switch is turned on; then the debug switch of the target application is turned on by a confirmation command to enable the debug switch on the confirmation page opened by the debug switch displayed on the debug host.
  • the webpage view debugging kernel is taken as an example of the TBS kernel, and the complete flow diagram of the above remote debugging process is shown, which specifically includes:
  • Step1 Debugging is set to allow USB debugging.
  • Step2 Set the App as the target app to be debugged.
  • the target App is debuggable.
  • the target App is not debugable (false)
  • an error status prompt is output.
  • the target App is debuggable (true)
  • the output of the current target App can be debugged.
  • TBS debugging If not, perform TBS debugging. If TBS debugging fails, download TBS Studio Client (TBS working client), install TBS Studio Client and install TBS kernel. Then, the target App calls the TBS kernel. If the TBS is successfully debugged, the direct target App calls the TBS kernel.
  • Step4 Set the TBS debugging switch.
  • the webpage view debugging kernel is taken as an example of the TBS kernel
  • the debug host includes the webview component of the target application, the ADB deamon component, and the installed TBS Studio Client, and the ADB Client is included in the debug host.
  • ADB Server, Debug Server, TBS Studio and other components are included in the debug host.
  • the complete process of the remote debugging process specifically includes:
  • the target APP webview sends a USB connection request to the ADB Daemon.
  • the user accesses the target APP webview.
  • ADB Server listens on port 5037 (listen on 5037).
  • the target APP webview sends the TBS SDK to the TBS Studio Client to trigger the use of the TBS kernel.
  • the TBS Studio Client sends an ADB debug development message to the ADB Daemon.
  • the ADB Client synchronizes the data to TBS Studio.
  • the apparatus includes a processor and a memory, the processor being capable of executing computer executable instructions in respective functional modules on the memory, as shown in FIG. 10, the functional modules on the memory including ADB The connection establishment module 102, the ADB detection instruction sending module 104, and the debugging module 106, wherein:
  • the ADB connection establishing module 102 establishes an ADB connection with the debug host
  • the ADB detection instruction sending module 104 sends an ADB detection instruction to the debug host, so that the debug host determines a target application running on the mobile phone, and the debug host is further configured to install a preset on the mobile phone.
  • a target webpage view debugging kernel wherein the target webpage view debugging kernel includes a webkit kernel for parsing webpage elements, and the webpage view debugging kernel is used to parse the webpage displayed in the webpage view of the target application;
  • the debugging module 106 receives debugging data of the webpage view displayed in the target application through the target webpage view debugging kernel sent by the debugging host via the ADB connection, and debugs the received debugging data.
  • the ADB connection establishing module 102 detects a debug host connected to the USB port and establishes an ADB connection with the debug host via USB.
  • the apparatus includes a processor and a memory, the processor being capable of executing computer executable instructions in respective functional modules on the memory, as shown in FIG.
  • the functional modules on the memory including ADB
  • the ADB connection establishing module 202 is configured to detect a debugging host connected to the USB port, and establish an ADB connection with the debugging host through the USB;
  • the target application determining module 204 establishes an ADB connection with the debugging host
  • the webpage view debugging kernel installation module 206 downloads and installs a preset target webpage view debugging kernel, and the target webpage view debugging kernel includes a webkit kernel for parsing webpage elements;
  • the debugging switch is turned on by the module 208, and the debugging switch of the target application is started by the target webpage view debugging kernel;
  • Debugging the data sending module 210 parsing the webpage view displayed in the target application, and sending, by the target webpage view debugging kernel, debug data of the webpage view displayed in the target application to the Debug the host's desktop debugging tool for debugging.
  • the ADB connection establishing module 202 receives an ADB detection instruction, and determines a target application to be debugged according to the ADB detection instruction.
  • the foregoing apparatus further includes a first determining module 212, Determining whether the target application implements a debugging interface corresponding to the target webpage view debugging kernel, and calling the webpage view debugging when the target application implements a debugging interface corresponding to the target webpage view debugging kernel Kernel installation module 206.
  • the debugging switch opening module 208 determines, when the target application implements a debugging interface corresponding to the target webpage view debugging kernel, whether the target application includes a scan code opening page function. If yes, the operation page opened with the debug switch of the target application is opened by scanning the two-dimensional code, the confirmation command input through the operation page is acquired, and the debugging switch of the target application is started according to the confirmation instruction.
  • the apparatus further includes a second determining module 214, determining whether the target application includes an installed webpage view debugging kernel; if the target application includes the installed webpage view Debugging the kernel, acquiring the installed webpage view debugging kernel as a target webpage view debugging kernel, and calling the debugging switch to open the module 208; if the target application does not include the installed webpage view debugging kernel, calling the The web page view debug kernel install module 206.
  • the webpage view debugging kernel installation module determines that a version number corresponding to the installed webpage view debugging kernel is not lower than the target when the target application includes an installed webpage view debugging kernel
  • the version number of the web page view debugging kernel is obtained; when the version number corresponding to the installed web page view debugging kernel is not lower than the version number corresponding to the target web page view debugging kernel, obtaining the installed web page view debugging kernel as the
  • the target web page view debugging kernel invokes the debugging switch to open the module 208; when the version number corresponding to the installed web page view debugging kernel is lower than the version number corresponding to the target web page view debugging kernel, the web page view is invoked
  • the kernel installation module 206 is debugged.
  • the webpage view debugging kernel installation module 206 downloads and installs a preset debugging tool client corresponding to the desktop debugging tool of the debugging host, and the debugging tool client includes the preset The target page view debug kernel.
  • the debug host and the debug host are connected through a USB, and after the target application to be debugged on the debug host is determined by the ADB instruction, the debug host is downloaded and installed.
  • the default web page view debugging kernel of the webkit kernel is used to debug the kernel of the webpage view to enable the debugging of the target application, so that the debug host's desktop debugging tool can display the webpage view displayed on the target application of the debug host. Debugging.
  • the debugging of the target application is triggered by installing the webpage view debugging kernel, so that all applications that implement the debugging interface corresponding to the webpage view debugging kernel can be debugged by debugging the host desktop debugging tool; Because the target application is an application that implements the debugging interface corresponding to the web page view debugging kernel, it is implemented by the web page view debugging kernel in the process of parsing and displaying the web page view, and the remote debugging is performed through the above.
  • the display of the web page view is also implemented by the web page view debugging kernel, which makes the real running environment of the debug web page view in the actual use process consistent with the host environment in the debugging process, to the maximum extent.
  • the real running environment of the web page view is restored, so that the developer can accurately locate the problems in the process of debugging and improve the efficiency.
  • FIG. 12 illustrates a terminal of a von Neumann-based computer system running the above-described debug host-based remote debugging method. Further, FIG. 12 also shows the above operation.
  • the computer system can be a personal computer (PC) with a desktop debugging tool, a server, a multi-processor system, a small computer, a mainframe computer, and a computer device such as a distributed computing environment including any of the above systems or devices.
  • an external input interface 1001, a processor 1002, a memory 1003, and an output interface 1004 connected by a system bus may be included.
  • the external input interface 1001 can optionally include at least a network interface 10012.
  • the memory 1003 can include an external memory 10032 (eg, Hard disk, optical disk or floppy disk, etc.) and internal memory 10034.
  • the output interface 1004 can include at least a device such as a display 10042.
  • the operation of the remote debugging method running on the debug host is based on a computer program, and the program file of the computer program is stored in the external memory 10032 of the aforementioned von Neumann system-based computer system, and is loaded at runtime.
  • the internal memory 10034 is then compiled into a machine code and then passed to the processor 1002 for execution, thereby forming a logical ADB connection establishing module 102, an ADB detecting instruction sending module 104, and the like in the von Neumann system-based computer system.
  • Debug module 106 Debug module 106.
  • the input parameters are received by the external input interface 1001, and transferred to the buffer in the memory 1003, and then input to the processor 1002 for processing, and the processed result data is cached in the memory 1003. Subsequent processing, or passed to output interface 1004 for output.
  • the processor 1002 performs the following operations:
  • the target webview debugging kernel includes a webkit kernel that parses the webpage element, and parses the webpage displayed in the webview of the target application by using the webview debugging kernel;
  • the processor 1002 detects a debug host connected to the USB port and establishes an ADB connection with the debug host via USB.
  • the operation of the remote debugging method running on the debug host is based on a computer program, and the program file of the computer program is stored in the aforementioned calculation based on the von Neumann system.
  • the external memory 10032 of the machine system is loaded into the internal memory 10034 at runtime, and then compiled into machine code and then transferred to the processor 1002 for execution, thereby forming a logical basis in the computer system based on the von Neumann system.
  • the input parameters are received by the external input interface 1001, and transferred to the buffer in the memory 1003, and then input to the processor 1002 for processing, and the processed result data is cached in the memory 1003. Subsequent processing, or passed to output interface 1004 for output.
  • the processor 1002 performs the following operations:
  • the debug data is debugged via a desktop debugging tool sent to the debug host via the ADB connection.
  • the processor 1002 detects a debug host to which the USB port is connected, and establishes the ADB connection with the debug host through the USB port.
  • the processor 1002 determines whether the target application implements a debug interface corresponding to the target web view debug kernel, and if so, performs downloading and installing a preset target web view debug kernel.
  • the processor 1002 implements the target with the target application
  • the webpage view debugs the debug interface corresponding to the kernel it is determined whether the target application includes a scan code open page function, and if it is included, the operation page opened with the debug switch of the target application is opened by scanning the two-dimensional code, and the operation page is obtained.
  • the confirmation command input by the operation page starts the debugging switch of the target application according to the confirmation instruction.
  • the processor 1002 determines whether the target application includes an installed web page view debug kernel
  • the target application includes the installed webpage view debugging kernel, acquiring the installed webpage view debugging kernel as a target webpage view debugging kernel, and executing the debugging of the target application by using the webpage view debugging kernel Debug switch
  • the target application does not include the installed web page view debug kernel, execute the download and install a preset web view debug kernel.
  • the processor 1002 determines that the version number corresponding to the installed webpage view debugging kernel is not lower than the target webpage view debugging kernel. version number;
  • the downloading and installing the preset target web page view debugging kernel is performed.
  • the processor 1002 downloads and installs a preset debug tool client corresponding to the debug host's desktop debugging tool, and the debug tool client includes the preset target web view debug kernel.
  • the foregoing program may be stored in a computer readable storage medium, and when executed, the program includes the steps of the foregoing method embodiment; and the foregoing storage medium includes: a mobile storage device A medium that can store program codes, such as a random access memory (RAM), a read-only memory (ROM), a magnetic disk, or an optical disk.
  • RAM random access memory
  • ROM read-only memory
  • magnetic disk or an optical disk.
  • the above-described integrated unit of the present invention may be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a standalone product.
  • the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for making
  • a computer device which may be a personal computer, server, or network device, etc.
  • the foregoing storage medium includes various media that can store program codes, such as a mobile storage device, a RAM, a ROM, a magnetic disk, or an optical disk.
  • the embodiment of the present invention further provides a computer storage medium, wherein the computer-executable instructions are stored, and the computer-executable instructions are executed by the processor to implement the remote debugging method of the embodiment of the present invention.
  • the technical solution of the embodiment of the present application triggers the debugging of the target application by installing the webpage view debugging kernel, so that all the applications that implement the debugging interface corresponding to the webpage view debugging kernel can be debugged by the desktop debugging tool of the debugging host.
  • Debugging and, because the target application is an application that implements the debugging interface corresponding to the web page view debugging kernel, it is itself through the web page view in the process of parsing and displaying the web page view.
  • Debugging the kernel implementation, and in the process of debugging through the above remote debugging method the display of the web page view is also implemented by the web page view debugging kernel, which makes the real running environment of the debug web page view in actual use and debugging.
  • the host environment in the process is consistent, and the real running environment of the web view is restored in the process of debugging, so that the developer can accurately locate the problems and improve the efficiency during the debugging process.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

一种远程调试方法及装置、计算机存储介质,包括:建立与调试主机之间的ADB连接(S202);接收ADB检测指令,根据所述ADB检测指令确定待调试的目标应用程序(S204);下载并安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核(S206);通过所述目标网页视图调试内核开启所述目标应用程序的调试开关,解析所述目标应用程序中展示的网页视图,并通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试(S208)。

Description

一种远程调试方法及装置、计算机存储介质
相关申请的交叉引用
本申请基于申请号为201611146675.2、申请日为2016年12月13日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本申请涉及计算机技术领域,尤其涉及一种远程调试方法及装置、计算机存储介质。
背景技术
所谓远程调试(Remote Debugging),就是通过运行在A机器上的调试客户端去调试一个运行在远程B机器上的应用程序,例如,通过运行在个人电脑(Personal Computer,PC)上的调试客户端去调试一个运行在移动终端(例如智能手机)上的应用程序。
现有技术中提供的一种调试方法是使用谷歌开发者工具(Chrome Dev Tools)来对移动终端上的应用程序进行调试。具体的,在进行调试的过程中,智能手机等移动终端上和PC上均需要安装谷歌浏览器,并且在调试的过程中只能用谷歌浏览器来访问页面。也就是说,在调试的过程中,网页视图(即webview页面)的显示和渲染都是通过谷歌浏览器来实现的,并且,对于还需要使用webkit内核才能实现对网页视图的加载;而在实际的应用中,并不是所有的网页视图都是通过谷歌浏览器来访问页面的,这就使得在调试的过程中,并不能真实的还原页面在移动终端上应用程序的实际的运行场景。也就是说,在谷歌浏览器下的网页视图的显示和渲染的具 体效果和问题与该网页视图在移动终端上相应的应用程序中的运行效果和问题是不一样的或者存在一定的差异,对于开发者来讲,无法真实还原调试的应用程序以及相应的网页视图的真实的宿主环境导致了开发者难以在开发和调试的过程中快速、准确的定位问题。
也就是说,在现有技术中的进行远程调试的方法因为无法真实还原移动终端上应用程序的真实的运行环境而存在无法准确的对出现的问题进行定位。
申请内容
基于此,为解决传统技术中的进行远程调试的方法因为无法真实还原移动终端上应用程序的真实的宿主环境而存在无法准确的对出现的问题进行定位的技术问题,本申请实施例提供了一种远程调试方法及装置、计算机存储介质。
本申请实施例的远程调试方法,包括:
建立与调试主机之间的安卓调试桥(ADB,Android Debug Bridge)连接;
接收ADB检测指令,根据所述ADB检测指令确定待调试的目标应用程序;
下载并安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核;
通过所述目标网页视图调试内核开启所述目标应用程序的调试开关,解析所述目标应用程序中展示的网页视图,并通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试。
本申请实施例的远程调试装置,包括:
ADB连接建立模块,建立与调试主机之间的ADB连接;
目标应用程序确定模块,接收ADB检测指令,根据所述ADB检测指令确定待调试的目标应用程序;
webview调试内核安装模块,下载并安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核;
调试开关开启模块,通过所述目标网页视图调试内核开启所述目标应用程序的调试开关;
调试数据发送模块,解析所述目标应用程序中展示的网页视图,并通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试。
本申请实施例的远程调试方法,包括:
建立与调试宿主机之间的ADB连接;
发送ADB检测指令给所述调试宿主机,以使所述调试宿主机确定手机上运行的目标应用程序,所述调试宿主机还用于在所述手机上安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核,通过所述网页视图调试内核解析所述目标应用程序的网页视图中展示的网页;
接收所述调试宿主机经由所述ADB连接发送的通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据,对所述接收的调试数据进行调试。
本申请实施例的远程调试装置,包括:
ADB连接建立模块,建立与调试宿主机之间的ADB连接;
ADB检测指令发送模块,发送ADB检测指令给所述调试宿主机,以使所述调试宿主机确定手机上运行的目标应用程序,所述调试宿主机还用于在所述手机上安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核,通过所述网页视图调试内核 解析所述目标应用程序的网页视图中展示的网页;
调试模块,接收所述调试宿主机经由所述ADB连接发送的通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据,对所述接收的调试数据进行调试。
本申请实施例的远程调试方法,包括:
调试宿主机建立与调试主机之间的ADB连接;
所述调试宿主机接收ADB检测指令,根据所述ADB检测指令确定待调试的目标应用程序;
所述调试宿主机下载并安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核;
所述调试宿主机通过所述目标网页视图调试内核开启所述目标应用程序的调试开关,解析所述目标应用程序中展示的网页视图,并通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试。
本申请实施例的远程调试方法,包括:
调试主机建立与调试宿主机之间的ADB连接;
所述调试主机发送ADB检测指令给所述调试宿主机,以使所述调试宿主机确定手机上运行的目标应用程序,所述调试宿主机还用于在所述手机上安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核,通过所述网页视图调试内核解析所述目标应用程序的网页视图中展示的网页;
所述调试主机接收所述调试宿主机经由所述ADB连接发送的通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据,对所述接收的调试数据进行调试。
本申请实施例的计算机存储介质,其上存储有计算机可执行指令,该 计算机可执行指令被处理器执行时实现上述的远程调试方法。
实施本申请实施例的技术方案,至少具有如下有益效果:
采用了上述远程调试方法和装置之后,在调试主机与调试宿主机之间建立ADB连接,并通过ADB指令确定在调试宿主机上的待调试的目标应用程序之后,在调试宿主机上下载并安装包含了webkit内核的预设的网页视图调试内核,然后通过该网页视图调试内核来开启目标应用程序的调试开关,从而使得调试主机的桌面调试工具可以对调试宿主机的目标应用程序上展示的网页视图进行调试。也就是说,通过安装网页视图调试内核来触发目标应用程序的调试开关,从而使得所有实现了与网页视图调试内核对应的调试接口的应用程序都可以通过调试主机的桌面调试工具进行调试;并且,因为目标应用程序为实现了与网页视图调试内核对应的调试接口的应用程序,因此,其本身在对网页视图进行解析并展示的过程中是通过网页视图调试内核实现的,而在通过上述远程调试方法进行调试的过程中,网页视图的展示也是通过网页视图调试内核实现的,这就使得调试的网页视图在实际使用过程中的真实运行环境与在调试过程中的宿主环境是一致的,最大程度的在调试的过程中还原网页视图的真实运行环境,使得开发者在调试的过程中能准确的对出现的问题进行定位,提高效率。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
其中:
图1为一个实施例中一种远程调试系统的组成示意图;
图2为一个实施例中调试主机上的桌面调试工具的界面示意图;
图3为一个实施例中一种远程调试过程的交互示意图;
图4为一个实施例中一种运行于调试主机上的远程调试方法的流程示意图;
图5为一个实施例中一种运行于调试宿主机上的远程调试方法的流程示意图;
图6为一个实施例目标应用程序的确认页面的界面示意图;
图7为一个实施例调试开关开启的确认页面的界面示意图;
图8为一个实施例中一种远程调试方法的流程示意图;
图9为一个实施例中远程调试过程的组件之间的交互过程的交互示意图;
图10为一个实施例中基于调试主机的远程调试装置的结构示意图;
图11为一个实施例中基于调试宿主机的远程调试装置的结构示意图;
图12为一个实施例中运行上述远程调试方法的计算机系统的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
为解决传统技术中的进行远程调试的方法因为无法真实还原移动终端上应用程序的真实的宿主环境而存在无法准确的对出现的问题进行定位的技术问题,在本实施例中,提出了一种远程调试系统。
参考图1,图1给出了一种远程调试系统的组成结构图,在一实施方式 中,该远程调试系统包括了调试主机和调试宿主机。其中,调试主机可以是安装了调试工具的计算机设备,例如,安装了桌面调试工具的个人电脑(Personal Computer,PC),也可以是安装了调试工具的例如服务器、多处理器系统、小型计算机、大型计算机以及包括任一上述系统或设备的分布式计算环境等计算机设备。进一步的,调试宿主机是进行调试的目标机,如智能手机、平板电脑或者其他移动终端设备。
在一个实施例中,上述安装于调试主机上的桌面调试工具可以是TBS Studio(TBS,即Tencent Browsing Service,中文:腾讯浏览服务,TBS Studio即为TBS桌面调试工具),用户可以在相应的下载网站下载该TBS桌面调试工具对应的API文件,并且该桌面调试工具不需要在调试主机上进行安装即可运行和对与调试主机连接的调试宿主机上的相应的APP上的程序进行调试。在图2中展示了调试主机上的桌面调试工具(TBS Studio)的操作界面。
在本实施例中,提出了一种远程调试机制,如图3所示,图3展示了该远程调试机制的调试主机与调试宿主机之间的交互过程,如图3所示,调试主机与调试宿主机之间的交互过程包括:
1)调试主机向调试宿主机发送建立ADB连接请求,与调试宿主机建立ADB连接。
2)调试主机生成ADB指令(也可简称为ADB检测指令)。
3)调试主机生成将ADB指令发送给调试宿主机。
4)调试宿主机根据ADB指令,确定手机上运行的目标APP。
5)调试宿主机将确定的目标APP发送给调试主机。
6)调试宿主机下载网页视图调试内核,安装网页视图调试内核,开启调试开关。
7)调试宿主机向调试主机发送网页视图的调试数据。
8)调试主机接收调试数据,对所述接收的调试数据进行调试。
由图3可知,本实施例的机制包括了运行于调试主机10上的远程调试方法以及运行于调试宿主机20上的远程调试方法。在一实施方式中,可如图4和图5所示,图4展示了运行于调试主机10上的远程调试方法,图5展示了运行于上述调试宿主机20上的远程调试方法。
图4为本发明实施例的一种运行于调试主机上的远程调试方法的流程示意图,如图4所示,包括:
步骤S102:检测USB端口连接的调试宿主机,与所述调试宿主机通过USB建立ADB连接。
步骤S104:发送ADB检测指令给所述调试宿主机,以使所述调试宿主机确定手机上运行的目标应用程序。
步骤S106:接收所述调试宿主机经由所述ADB连接发送的通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据,对所述接收的调试数据进行调试。
具体实施中,在调试主机与调试宿主机之间可以是通过USB(Universal Serial Bus,通用串行总线)数据线进行连接,也可以是通过其他方式进行连接,例如,通过WIFI连接。具体实施中,例如,在调试主机与调试宿主机的连接是通过USB建立的情况下,调试宿主机和调试主机之间通过对USB端口的检测建立调试主机与调试宿主机之间的通讯连接,并确定在调试宿主机上运行的待调试的目标应用程序,然后在调试宿主机上安装相应的调试内核以使调试宿主机上的目标应用程序的网页视图空间(即webview控件,Android系统中用于显示网页的控件,用户直接显示和渲染网页视图)中展示的网页数据进行调试。
下面针对上述运行于调试宿主机的远程调试的方法的具体过程分步骤进行详细阐述,参考图5的步骤S202至步骤S208。
步骤S202:建立与调试主机之间的ADB连接。
在本实施例中,调试宿主机与调试主机之间的连接可以是通过USB建立的,也可以是通过WIFI建立的。
例如,在通过WIFI建立调试主机与调试宿主机的情况下,在调试宿主机对应的Android设备上安装一个超级终端,并在终端里运行相应的ADB连接建立的代码,然后,在调试主机端打开cmd命令行,输入:adb connect android设备IP地址,即可建立调试主机与调试宿主机之间的ADB连接。
在一实施方式中,上述建立与调试主机之间的ADB连接的步骤具体为:调试宿主机检测USB端口连接的调试主机,与所述调试主机通过USB建立ADB连接。
在本实施例中,调试宿主机与调试主机之间的通讯连接可以是通过USB端口建立的,也就是说,在用USB数据线将调试主机和调试宿主机连接起来之后,调试宿主机通过相应的USB端口检测到相应的USB连接,并检测与调试宿主机之间通过USB数据线连接的调试主机,并通过调试主机上的USB端调试宿主机上的USB端口以及连接二者的USB数据线,建立与该连接的调试主机之间的通讯连接。
需要说明的是,在本实施例中,调试主机与调试宿主机之间的通讯连接为ADB连接。ADB,即Android Debug Bridge(安卓调试桥接),是Android SDK(Androidsoftware development kit,安卓系统专属的软件开发工具包)中的一个工具,使用ADB可以直接操作管理Android模拟器或者真实的Andriod设备。调试主机与调试宿主机之间的ADB连接即建立调试宿主机中的ADB与调试主机上的调试工具之间的通讯连接,使得调试主机可以发送相应的ADB指令给调试宿主机。在调试主机与调试宿主机之间的ADB连接建立之后,调试主机即可向调试宿主机发送ADB指令对调试宿主机进行调试。
在一实施方式中,调试主机向调试宿主机发送的ADB指令包括adb devices、adb uninstall<软件名>等,通过ADB指令可以实现的功能包括在Android设备上运行Shell(命令行)、管理模拟器或设备的端口映射、在计算机和设备之间上传/下载文件、将电脑上的本地APK软件安装至Android模拟器或设备上等。
步骤S204:接收ADB检测指令,根据所述ADB检测指令确定待调试的目标应用程序。
在本实施例中,在需要确定调试宿主机上当前正在运行的应用程序时,可以通过调试主机向调试宿主机发送ADB指令来实现。
在一实施方式中,调试主机向调试宿主机发送ADB检测指令,确定在调试宿主机上运行的应用程序,在调试宿主机上运行的应用程序即为当前调试的待调试的目标应用程序。
需要说明的是,在本实施例中,待调试的目标应用程序可以是在调试宿主机上当前正在运行的应用程序;例如,在调试宿主机为智能手机时,若手机的显示屏上当前显示的操作页面是与“微信”对应的操作页面,则当前在手机上运行的目标应用程序为“微信”,也即为待调试的目标应用程序。
在本实施例中,若开发者当前需要调试的应用程序不是调试宿主机上的显示界面所对应的运行应用程序,而是其他应用程序,则需要该开发者手动的选择需要调试的应用程序,并根据用户的选择操作将该被选择的应用程序设置为待调试的目标应用程序,或者,重新接收调试主机发送的ADB检测指令来重新确定目标应用程序。
例如,在本实施例中,在调试宿主机为智能手机时,若手机的显示屏上当前显示的操作页面是与“QQ音乐”对应的操作页面,则当前在手机上运行的目标应用程序为“QQ音乐”。在调试的过程中,在作为调试主机(PC 端)通过ADB检测指令确定了当前在手机的显示界面上运行的应用程序为“QQ音乐”之后并展示如图6所示的提示窗口之后,开发者确定“QQ音乐”是当前需要进行调试的应用程序,即点击“确认”按钮,从而将“QQ音乐”作为当前调试的目标应用程序;进一步的,若开发者确定“QQ音乐”并不是其当前需要进行调试的应用程序,则针对展示的提示窗口输入与按钮“取消”对应的指令,并且在手机上手动的切换至需要调试的应用程序对应的操作页面,以使PC端在再次通过ADB指令确定待检测的目标应用程序时确定待检测的目标应用程序。
步骤S206:下载并安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核。
webkit内核是一种浏览器内核,在终端上的浏览器中页面的渲染以及在应用程序中的网页视图(webview页面)的渲染都需要通过浏览器内核来进行。一般来讲,在终端中安装的应用程序没有内置内核的情况下,默认使用系统内核来渲染网页视图。
在调试宿主机建立了与调试主机之间的ADB连接之后,在对调试宿主机上的应用程序这种的网页视图进行调试的过程中,对于网页视图的渲染需要使用到内核来解析网页元素,而在Android系统中,系统内核是不支持远程调试的。而在常用的调试工具中(例如谷歌调试工具),是使用谷歌浏览器中内置的webkit内核来解析网页视图的,也就是说,所有的网页视图的渲染都是基于谷歌浏览器的;而在调试宿主机中真实的运行环境中,大部分应用程序都不是基于谷歌浏览器来开发的,也就是说,其中网页视图的渲染并不是通过谷歌浏览器来完成的。
而在本实施例中,网页视图调试内核为包含有解析网页元素的webkit内核,即时基于wekit内核开发的内核,该网页视图调试内核继承了webkit内核的所有的功能。在一个具体的实施例中,上述网页视图调试内核可以 是TBS内核,即腾讯浏览服务中基于webkit内核开发的内核。
需要说明的是,在本实施例中,在下载并安装预设的目标网页视图调试内核之前,还需要对目标应用程序是否支持调试进行判断。在一实施方式中,所述下载并安装预设的目标网页视图调试内核之前还包括:判断所述目标应用程序是否实现了与所述目标网页视图调试内核对应的调试接口,若是,则执行下载并安装预设的目标网页视图调试内核。
在本实施例中,对于某一个应用程序来说,若其未实现与目标网页视图调试内核对应的调试接口,则不能使用调试主机上的桌面调试工具进行调试,即不适用于本申请实施例的调试方法;若该应用程序实现了与目标网页视图调试内核对应的调试接口,则可使用调试主机上的桌面调试工具进行调试。
对于实现了与网页视图调试内核对应的调试接口的应用程序来讲,主要分为两种情况,一为该应用程序本身内置了网页视图调试内核,并且在加载网页视图时使用该内置的网页视图调试内核进行加载;二是,该应用程序本身并未内置网页视图调试内核,但是在加载网页视图的过程中是调用终端中其他应用程序内置的网页视图调试内核来实现的。真是上述任意一种情况,其网页视图的展示都是通过网页视图调试内核实现。
需要说明的是,若在调试宿主机中安装的应用程序中包括了接入了TBS内核的应用程序,例如QQ、QQ音乐、京东商城等,但是对于不同的应用程序接入TBS内核的方式存在差异;在一实施方式中,若该应用程序已经内置TBS内核,也就是说,在该应用程序安装之后即静默下载并安装了TBS内核,又或者,该应用程序虽然接入例如TBS内核,但是并不是在安装应用程序成功之后即静默下载TBS内核,而是在访问页面时,查找已经在终端中安装的内置TBS内核的应用程序并使用该TBS内核,若没有查找到TBS内核,则自行下载并安装TBS内核;对于上述两种情况,在终端 中都已经下载并安装了TBS内核。
在本实施例中,若需要对待调试的目标应用程序进行调试,则需要在调试宿主机上已经下载并安装了预设的目标网页视图调试内核,该目标网页视图调试内核可以是在之前已经预先下载并安装的,也可以是在确定了待测试的目标应用程序之后下载并安装的,具体可根据待调试的目标应用程序是否已经内置了目标网页视图调试内核或者已经接入了终端中其他应用程序中下载并安装的目标网页视图调试内核。
在一实施方式中,在一个可选的实施例中,所述下载并安装预设的目标网页视图调试内核之前还包括:判断所述目标应用程序是否包括已安装网页视图调试内核;若所述目标应用程序包括所述已安装网页视图调试内核,则获取所述已安装网页视图调试内核作为目标网页视图调试内核,并执行所述通过所述网页视图调试内核开启所述目标应用程序的调试开关;若所述目标应用程序未包括所述已安装网页视图调试内核,则执行所述下载并安装预设的网页视图调试内核。
例如,在基于TBS内核开发的微信、QQ、QQ浏览器等应用程序中,在安装了该应用程序之后,即静默下载并安装了TBS内核,也就是说,在步骤S206中,不需要再次下载并安装TBS内核。再例如,在接入例如TBS内核的QQ音乐、滴滴出行、京东商城等应用程序中,应用程序在访问webview页面时,会在手机中查找是否已经安装了内置TBS内核的微信、QQ等应用程序,若应安装,则调用该查找到的TBS内核来访问网页视图,即其TBS内核的使用方式是共享其他内置了TBS内核的应用程序中内置的TBS内核;对于这种情况,在步骤S206中也不需要再次下载并安装TBS内核。进一步的,若在上述在手机中查找是否已经安装了内置TBS内核的微信、QQ等应用程序的步骤中,没有查找到相应的应用程序,则需要执行步骤S206,即下载并安装预设的目标网页视图调试内核。
在本实施例中,对于上述在调试主机中已经下载并安装了网页视图调试内核并且在步骤S206中不需要再次进行目标网页视图调试内核的安装的情况,还需要确定当前安装的目标网页视图调试内核是否为最新的版本。
在一实施方式中,在上述判断所述目标应用程序是否包括已安装网页视图调试内核步骤之后还包括:在所述目标应用程序包括已安装网页视图调试内核时,确定与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号;在与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号时,获取所述已安装网页视图调试内核作为所述目标网页视图调试内核,并执行所述通过所述目标网页视图调试内核开启所述目标应用程序的调试开关的步骤;在与所述已安装网页视图调试内核对应的版本号低于所述目标网页视图调试内核对应的版本号时,执行所述下载并安装预设的目标网页视图调试内核。
在本实施例中,因为网页视图调试内核的版本是不断更新的,在目标应用程序中包含的网页视图调试内核可能在时当前最新的版本发布之前下载并安装的,因此,其可能并不是最新的版本。在本实施例中,为了避免因为网页视图调试内核的版本而导致调试的过程中出现问题,还需要确定在调试宿主机中安装的网页视图调试内核为最新的版本。
在本实施例中,调试宿主机下载目标网页视图调试内核的步骤还可以是通过下载并安装与所述调试主机上的桌面调试工具对应的调试工具客户端完成的,也就是说,在下载并安装上述调试工具客户端的过程中,因为在该调试工具客户端中内置了网页视图调试内核,因此,也就下载并安装了目标网页视图调试内核。例如,在调试主机上桌面调试工具为TBS Studio的情况下,在本步骤中,在调试宿主机上下载并安装的是与TBS Studio对应的客户端,即TBS Studio Client,并将该TBS Studio Client作为调试内核 代理应用程序。
步骤S208:通过所述目标网页视图调试内核开启所述目标应用程序的调试开关,解析所述目标应用程序中展示的webview网页,并通过所述目标网页视图调试内核将所述目标应用程序中展示的webview网页的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试。
一般来讲,调试状态并不是调试宿主机的常态,也就是说,在默认情况下,调试宿主机中安装的应用程序时默认未开启调试开关,不能进行调试。在本实施例中,通过目标网页视图调试内核来气目标应用程序的调试开关。在图7中展示了在开启调试开关的确认页面,开发者可以通过该确认页面来确定开启目标应用程序的调试开关。
在一实施方式中,在一个实施例中,若目标应用程序为内置TBS内核的应用程序(如微信、QQ等),则可通过访问debugx5.qq.com进行开启调试开关。在另一个实施例中,在调试宿主机下载并安装了TBS Studio Client的情况下,通过该TBS Studio Client开启调试开关。
在开启了目标应用程序的调试开关之后,即可在调试主机上对调试宿主机上目标应用程序中展示的网页视图进行调试,即调试宿主机通过与调试主机之间的ADB连接将展示的网页视图相关的数据发送给调试主机上的桌面调试工具进行调试。
在一实施方式中,在调试宿主机上通过目标应用程序展示webview网页时,因为需要调用目标网页视图调试内核来解析与该webview网页对应的代码才能展示该webview网页,因此,在检测到对目标网页视图调试内核的调用时,即执行通过所述目标网页视图调试内核将所述目标应用程序中展示的webview网页的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试的步骤。
在本实施例中,若目标应用程序包括了网页视图调试内核,则不需要 下载目标网页视图调试内核,但是,因为在上述开启目标应用程序的调试开关时,需要出发调试开关的开启,在本实施例中,调试开关的开启可以是通过在调试宿主机上下载并安装的调试工作客户端(如TBS Studio Client)完成的。
在另一个实施例中,调试开关的开启还可以是通过其他方式完成的,例如,通过扫描二维码开出发调试开关的开启。
在一实施方式中,所述判断所述目标应用程序是否实现了与所述目标网页视图调试内核对应的调试接口之后还包括:在所述目标应用程序实现了与所述目标网页视图调试内核对应的调试接口时,判断所述目标应用程序是否包含扫码打开页面功能,若包含,则通过扫描二维码打开与所述目标应用程序的调试开关开启的操作页面,获取通过所述操作页面输入的确认指令,根据所述确认指令开启所述目标应用程序的调试开关。
例如,对于应用程序“微信”来讲,其支持扫描二维码打开网页或者其他页面;在本实施例中,在确定了调试宿主机中已安装目标网页视图调试内核之后,在调试主机上生成与开启调试开关对应的二维码,开发者可以通过调试宿主机的目标应用程序扫描在调试主机上的二维码进入到与目标应用程序的调试开关开启对应的操作页面,该操作页面可以是调试开关开启的确认页面;然后通过在调试宿主机上展示的调试开关开启的确认页面输入开启调试开关的确认指令来开启目标应用程序的调试开关。
参考图8,在图8中以网页视图调试内核为TBS内核为例,展示了上述远程调试过程的完整的流程示意图,具体包括:
step1:调试设置为允许USB调试。
然后,判断USB是否成功连接。当USB连接失败(false)时,输出错误状态提示。当USB连接成功(true)时,输出成功状态提示。
step2:设定App,作为待调试的目标App。
然后,判断目标App是否可调试。当目标App不可调试(false)时,输出错误状态提示。当目标App可调试(true)时,输出当前的目标App可调试。
sep3:检测是否支持TBS调试。
然后,检测是否支持扫码打开页面。
否时,进行TBS调试,如果TBS调试失败,则下载TBS Studio Client(TBS工作客户端),并安装TBS Studio Client以及安装TBS内核。而后,目标App调用TBS内核。如果TBS调试成功,则直接目标App调用TBS内核。
是时,扫描二维码进入中转确认页,并获取TBS新版本;如果获取成功,则执行步骤step4;如果获取失败,则跳转到调试页面,并点击安装线上内核,从而完成内核安装。内核安装完成后,继续扫描二维码进入中转确认页。
step4:设定TBS调试开关。
然后,启动调试。
参考图9,在图9中展示了在上述远程调试的过程中调试主机以及调试宿主机中各个组件之间的交互过程。在一实施方式中,以网页视图调试内核为TBS内核为例,在调试宿主机中包含了与目标应用程序的webview组件、ADB deamon组件以及安装的TBS Studio Client,在调试主机中包含了ADB Client、ADB Server、Debug Server、TBS Studio等组件。
参考图9,远程调试过程的完整的流程,具体包括:
1)目标APP webview向ADB Daemon发送USB连接请求。
预先,用户访问目标APP webview。
2)ADB Daemon与ADB Server之间建立USB/TCP连接。
3)ADB Server监听5037端口(listen on 5037)。
4)ADB Client和ADB Server之间建立TCP连接。
5)ADB Client和TBS Studio之间建立TCP连接。
6)目标APP webview向TBS Studio Client发送TBS SDK以触发使用TBS内核。
7)TBS Studio Client向ADB Daemon发送开启ADB调试开发消息。
8)ADB Daemon和ADB Server之间建立USB/TCP连接。
9)ADB Client和ADB Server之间建立TCP连接。
10)ADB Client将数据同步到TBS Studio。
此外,为解决传统技术中的进行远程调试的方法因为无法真实还原移动终端上应用程序的真实的宿主环境而存在无法准确的对出现的问题进行定位的技术问题,在本实施例中,如图10所示,还提出了一种远程调试装置,该远程调试装置基于上述远程调试系统的调试主机10。在一实施方式中,该装置包括处理器和存储器,所述处理器能够运行所述存储器上的各个功能模块中的计算机可执行指令,如图10所示,所述存储器上的功能模块包括ADB连接建立模块102、ADB检测指令发送模块104以及调试模块106,其中:
ADB连接建立模块102,建立与调试宿主机之间的ADB连接;
ADB检测指令发送模块104,发送ADB检测指令给所述调试宿主机,以使所述调试宿主机确定手机上运行的目标应用程序,所述调试宿主机还用于在所述手机上安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核,通过所述网页视图调试内核解析所述目标应用程序的网页视图中展示的网页;
调试模块106,接收所述调试宿主机经由所述ADB连接发送的通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据,对所述接收的调试数据进行调试。
在一个实施例中,ADB连接建立模块102,检测USB端口连接的调试宿主机,与所述调试宿主机通过USB建立ADB连接。
此外,为解决传统技术中的进行远程调试的方法因为无法真实还原移动终端上应用程序的真实的宿主环境而存在无法准确的对出现的问题进行定位的技术问题,在本实施例中,如图11所示,还提出了一种远程调试装置,该远程调试装置基于上述远程调试系统的调试宿主机20。在一实施方式中,该装置包括处理器和存储器,所述处理器能够运行所述存储器上的各个功能模块中的计算机可执行指令,如图11所示,所述存储器上的功能模块包括ADB连接建立模块202、目标应用程序确定模块204、网页视图调试内核安装模块206、调试开关开启模块208以及调试数据发送模块210,其中:
ADB连接建立模块202,检测USB端口连接的调试主机,与所述调试主机通过USB建立ADB连接;
目标应用程序确定模块204,建立与调试主机之间的ADB连接;
网页视图调试内核安装模块206,下载并安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核;
调试开关开启模块208,通过所述目标网页视图调试内核开启所述目标应用程序的调试开关;
调试数据发送模块210,解析所述目标应用程序中展示的网页视图,并通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试。
在一个实施例中,所述ADB连接建立模块202,接收ADB检测指令,根据所述ADB检测指令确定待调试的目标应用程序。
在一个实施例中,如图11所示,上述装置还包括第一判断模块212, 判断所述目标应用程序是否实现了与所述目标网页视图调试内核对应的调试接口,在所述目标应用程序实现了与所述目标网页视图调试内核对应的调试接口时,调用所述网页视图调试内核安装模块206。
在一个实施例中,所述调试开关开启模块208,在所述目标应用程序实现了与所述目标网页视图调试内核对应的调试接口时,判断所述目标应用程序是否包含扫码打开页面功能,若包含,则通过扫描二维码打开与所述目标应用程序的调试开关开启的操作页面,获取通过所述操作页面输入的确认指令,根据所述确认指令开启所述目标应用程序的调试开关。
在一个实施例中,如图11所示,上述装置还包括第二判断模块214,判断所述目标应用程序是否包括已安装网页视图调试内核;若所述目标应用程序包括所述已安装网页视图调试内核,则获取所述已安装网页视图调试内核作为目标网页视图调试内核,并调用所述调试开关开启模块208;若所述目标应用程序未包括所述已安装网页视图调试内核,调用所述网页视图调试内核安装模块206。
在一个实施例中,所述网页视图调试内核安装模块,在所述目标应用程序包括已安装网页视图调试内核时,确定与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号;在与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号时,获取所述已安装网页视图调试内核作为所述目标网页视图调试内核,调用所述调试开关开启模块208;在与所述已安装网页视图调试内核对应的版本号低于所述目标网页视图调试内核对应的版本号时,调用所述网页视图调试内核安装模块206。
在一个实施例中,所述网页视图调试内核安装模块206,下载并安装预设的与所述调试主机的桌面调试工具对应的调试工具客户端,所述调试工具客户端包括所述预设的目标网页视图调试内核。
实施本申请实施例,将具有如下有益效果:
采用了上述远程调试方法和装置之后,调试主机与调试宿主机之间通过USB连接,在通过ADB指令确定在调试宿主机上的待调试的目标应用程序之后,在调试宿主机上下载并安装包含了webkit内核的预设的网页视图调试内核,然后通过该网页视图调试内核来开启目标应用程序的调试开关,从而使得调试主机的桌面调试工具可以对调试宿主机的目标应用程序上展示的网页视图进行调试。也就是说,通过安装网页视图调试内核来触发目标应用程序的调试开关,从而使得所有实现了与网页视图调试内核对应的调试接口的应用程序都可以通过调试主机的桌面调试工具进行调试;并且,因为目标应用程序为实现了与网页视图调试内核对应的调试接口的应用程序,因此,其本身在对网页视图进行解析并展示的过程中是通过网页视图调试内核实现的,而在通过上述远程调试方法进行调试的过程中,网页视图的展示也是通过网页视图调试内核实现的,这就使得调试的网页视图在实际使用过程中的真实运行环境与在调试过程中的宿主环境是一致的,最大程度的在调试的过程中还原网页视图的真实运行环境,使得开发者在调试的过程中能准确的对出现的问题进行定位,提高效率。
在一个实施例中,如图12所示,图12展示了一种运行上述基于调试主机的远程调试方法的基于冯诺依曼体系的计算机系统的终端,进一步的,图12展示的也是运行上述基于调试宿主机的远程调试方法的基于冯诺依曼体系的计算机系统的终端。该计算机系统可以是安装了桌面调试工具的个人电脑(Personal Computer,PC)、服务器、多处理器系统、小型计算机、大型计算机以及包括任一上述系统或设备的分布式计算环境等计算机设备。在一实施方式中,可包括通过系统总线连接的外部输入接口1001、处理器1002、存储器1003和输出接口1004。其中,外部输入接口1001可选的可至少包括网络接口10012。存储器1003可包括外存储器10032(例如 硬盘、光盘或软盘等)和内存储器10034。输出接口1004可至少包括显示屏10042等设备。
在本实施例中,上述运行于调试主机的远程调试方法的运行基于计算机程序,该计算机程序的程序文件存储于前述基于冯诺依曼体系的计算机系统的外存储器10032中,在运行时被加载到内存储器10034中,然后被编译为机器码之后传递至处理器1002中执行,从而使得基于冯诺依曼体系的计算机系统中形成逻辑上的ADB连接建立模块102、ADB检测指令发送模块104以及调试模块106。且在上述远程调试方法执行过程中,输入的参数均通过外部输入接口1001接收,并传递至存储器1003中缓存,然后输入到处理器1002中进行处理,处理的结果数据或缓存于存储器1003中进行后续地处理,或被传递至输出接口1004进行输出。
在一实施方式中,处理器1002执行如下操作:
建立与调试宿主机之间的ADB连接;
发送ADB检测指令给所述调试宿主机,以使所述调试宿主机确定手机上运行的目标应用程序,所述调试宿主机还用于在所述手机上安装预设的目标webview调试内核,所述目标webview调试内核中包含有解析网页元素的webkit内核,通过所述webview调试内核解析所述目标应用程序的webview中展示的网页;
接收所述调试宿主机经由所述ADB连接发送的通过所述目标webview调试内核将所述目标应用程序中展示的webview网页的调试数据,对所述接收的调试数据进行调试。
在一个实施例中,处理器1002检测USB端口连接的调试宿主机,与所述调试宿主机通过USB建立ADB连接。
在本实施例中,上述运行于调试宿主机的远程调试方法的运行基于计算机程序,该计算机程序的程序文件存储于前述基于冯诺依曼体系的计算 机系统的外存储器10032中,在运行时被加载到内存储器10034中,然后被编译为机器码之后传递至处理器1002中执行,从而使得基于冯诺依曼体系的计算机系统中形成逻辑上的ADB连接建立模块202、目标应用程序确定模块204、网页视图调试内核安装模块206、调试开关开启模块208、调试数据发送模块210、第一判断模块212以及第二判断模块214。且在上述远程调试方法执行过程中,输入的参数均通过外部输入接口1001接收,并传递至存储器1003中缓存,然后输入到处理器1002中进行处理,处理的结果数据或缓存于存储器1003中进行后续地处理,或被传递至输出接口1004进行输出。
在一实施方式中,处理器1002执行如下操作:
建立与调试主机之间的ADB连接;
接收ADB检测指令,根据所述ADB检测指令确定待调试的目标应用程序;
下载并安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核;
通过所述目标网页视图调试内核开启所述目标应用程序的调试开关,解析所述目标应用程序中展示的网页视图,并通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试。
在一个实施例中,处理器1002检测USB端口连接的调试主机,通过所述USB端口与所述调试主机建立所述ADB连接。
在一个实施例中,处理器1002判断所述目标应用程序是否实现了与所述目标网页视图调试内核对应的调试接口,若是,则执行下载并安装预设的目标网页视图调试内核。
在一个实施例中,处理器1002在所述目标应用程序实现了与所述目标 网页视图调试内核对应的调试接口时,判断所述目标应用程序是否包含扫码打开页面功能,若包含,则通过扫描二维码打开与所述目标应用程序的调试开关开启的操作页面,获取通过所述操作页面输入的确认指令,根据所述确认指令开启所述目标应用程序的调试开关。
在一个实施例中,处理器1002判断所述目标应用程序是否包括已安装网页视图调试内核;
若所述目标应用程序包括所述已安装网页视图调试内核,则获取所述已安装网页视图调试内核作为目标网页视图调试内核,并执行所述通过所述网页视图调试内核开启所述目标应用程序的调试开关;
若所述目标应用程序未包括所述已安装网页视图调试内核,则执行所述下载并安装预设的网页视图调试内核。
在一个实施例中,处理器1002在所述目标应用程序包括已安装网页视图调试内核时,确定与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号;
在与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号时,获取所述已安装网页视图调试内核作为所述目标网页视图调试内核,并执行所述通过所述目标网页视图调试内核开启所述目标应用程序的调试开关的步骤;
在与所述已安装网页视图调试内核对应的版本号低于所述目标网页视图调试内核对应的版本号时,执行所述下载并安装预设的目标网页视图调试内核。
在一个实施例中,处理器1002下载并安装预设的与所述调试主机的桌面调试工具对应的调试工具客户端,所述调试工具客户端包括所述预设的目标网页视图调试内核。
本领域的技术人员可以理解:实现上述方法实施例的全部或部分步骤 可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储装置、随机存取存储器(RAM,Random Access Memory)、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
或者,本发明上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机装置(可以是个人计算机、服务器、或者网络装置等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储装置、RAM、ROM、磁碟或者光盘等各种可以存储程序代码的介质。
相应地,本发明实施例还提供一种计算机存储介质,其中存储有计算机可执行指令,该计算机可执行指令被处理器执行时实现本发明实施例的上述远程调试方法。
以上所揭露的仅为本申请较佳实施例而已,当然不能以此来限定本申请之权利范围,因此依本申请权利要求所作的等同变化,仍属本申请所涵盖的范围。
工业实用性
本申请实施例的技术方案,通过安装网页视图调试内核来触发目标应用程序的调试开关,从而使得所有实现了与网页视图调试内核对应的调试接口的应用程序都可以通过调试主机的桌面调试工具进行调试;并且,因为目标应用程序为实现了与网页视图调试内核对应的调试接口的应用程序,因此,其本身在对网页视图进行解析并展示的过程中是通过网页视图 调试内核实现的,而在通过上述远程调试方法进行调试的过程中,网页视图的展示也是通过网页视图调试内核实现的,这就使得调试的网页视图在实际使用过程中的真实运行环境与在调试过程中的宿主环境是一致的,最大程度的在调试的过程中还原网页视图的真实运行环境,使得开发者在调试的过程中能准确的对出现的问题进行定位,提高效率。

Claims (28)

  1. 一种远程调试方法,包括:
    建立与调试主机之间的安卓调试桥ADB连接;
    接收ADB检测指令,根据所述ADB检测指令确定待调试的目标应用程序;
    下载并安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核;
    通过所述目标网页视图调试内核开启所述目标应用程序的调试开关,解析所述目标应用程序中展示的网页视图,并通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试。
  2. 根据权利要求1所述的远程调试方法,其中,所述建立与调试主机之间的ADB连接还包括:
    检测USB端口连接的调试主机,通过所述USB端口与所述调试主机建立所述ADB连接。
  3. 根据权利要求1所述的远程调试方法,其中,所述下载并安装预设的目标网页视图调试内核之前还包括:
    判断所述目标应用程序是否实现了与所述目标网页视图调试内核对应的调试接口,若是,则执行下载并安装预设的目标网页视图调试内核。
  4. 根据权利要求3所述的远程调试方法,其中,所述判断所述目标应用程序是否实现了与所述目标网页视图调试内核对应的调试接口之后还包括:
    在所述目标应用程序实现了与所述目标网页视图调试内核对应的调试接口时,判断所述目标应用程序是否包含扫码打开页面功能,若包含,则通过扫描二维码打开与所述目标应用程序的调试开关开启的操作页 面,获取通过所述操作页面输入的确认指令,根据所述确认指令开启所述目标应用程序的调试开关。
  5. 根据权利要求1所述的远程调试方法,其中,所述下载并安装预设的目标网页视图调试内核之前还包括:
    判断所述目标应用程序是否包括已安装网页视图调试内核;
    若所述目标应用程序包括所述已安装网页视图调试内核,则获取所述已安装网页视图调试内核作为目标网页视图调试内核,并执行所述通过所述网页视图调试内核开启所述目标应用程序的调试开关;
    若所述目标应用程序未包括所述已安装网页视图调试内核,则执行所述下载并安装预设的网页视图调试内核。
  6. 根据权利要求5所述的远程调试方法,其中,所述判断所述目标应用程序是否包括已安装网页视图调试内核之后还包括:
    在所述目标应用程序包括已安装网页视图调试内核时,确定与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号;
    在与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号时,获取所述已安装网页视图调试内核作为所述目标网页视图调试内核,并执行所述通过所述目标网页视图调试内核开启所述目标应用程序的调试开关的步骤;
    在与所述已安装网页视图调试内核对应的版本号低于所述目标网页视图调试内核对应的版本号时,执行所述下载并安装预设的目标网页视图调试内核。
  7. 根据权利要求1所述的远程调试方法,其中,所述下载并安装预设的目标网页视图调试内核还包括:
    下载并安装预设的与所述调试主机的桌面调试工具对应的调试工具 客户端,所述调试工具客户端包括所述预设的目标网页视图调试内核。
  8. 一种远程调试装置,包括处理器和存储器,所述处理器能够运行所述存储器上的各个功能模块中的计算机可执行指令,所述存储器上的功能模块包括:
    ADB连接建立模块,建立与调试主机之间的ADB连接;
    目标应用程序确定模块,接收ADB检测指令,根据所述ADB检测指令确定待调试的目标应用程序;
    webview调试内核安装模块,下载并安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核;
    调试开关开启模块,通过所述目标网页视图调试内核开启所述目标应用程序的调试开关;
    调试数据发送模块,解析所述目标应用程序中展示的网页视图,并通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试。
  9. 根据权利要求8所述的远程调试装置,其中,所述ADB连接建立模块,检测USB端口连接的调试主机,通过所述USB端口与所述调试主机建立所述ADB连接。
  10. 根据权利要求8所述的远程调试装置,其中,所述装置还包括第一判断模块,判断所述目标应用程序是否实现了与所述目标网页视图调试内核对应的调试接口,在所述目标应用程序实现了与所述目标网页视图调试内核对应的调试接口时,调用所述网页视图调试内核安装模块。
  11. 根据权利要求10所述的远程调试装置,其中,所述调试开关开启模块,在所述目标应用程序实现了与所述目标网页视图调试内核对应的调试接口时,判断所述目标应用程序是否包含扫码打开页面功能,若 包含,则通过扫描二维码打开与所述目标应用程序的调试开关开启的操作页面,获取通过所述操作页面输入的确认指令,根据所述确认指令开启所述目标应用程序的调试开关。
  12. 根据权利要求8所述的远程调试装置,其中,所述装置还包括第二判断模块,判断所述目标应用程序是否包括已安装网页视图调试内核;若所述目标应用程序包括所述已安装网页视图调试内核,则获取所述已安装网页视图调试内核作为目标网页视图调试内核,并调用所述调试开关开启模块;若所述目标应用程序未包括所述已安装网页视图调试内核,调用所述网页视图调试内核安装模块。
  13. 根据权利要求12所述的远程调试装置,其中,所述网页视图调试内核安装模块,在所述目标应用程序包括已安装网页视图调试内核时,确定与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号;在与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号时,获取所述已安装网页视图调试内核作为所述目标网页视图调试内核,调用所述调试开关开启模块;在与所述已安装网页视图调试内核对应的版本号低于所述目标网页视图调试内核对应的版本号时,调用所述网页视图调试内核安装模块。
  14. 根据权利要求8所述的远程调试装置,其中,所述网页视图调试内核安装模块,下载并安装预设的与所述调试主机的桌面调试工具对应的调试工具客户端,所述调试工具客户端包括所述预设的目标网页视图调试内核。
  15. 一种远程调试方法,包括:
    建立与调试宿主机之间的ADB连接;
    发送ADB检测指令给所述调试宿主机,以使所述调试宿主机确定手 机上运行的目标应用程序,所述调试宿主机还用于在所述手机上安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核,通过所述网页视图调试内核解析所述目标应用程序的网页视图中展示的网页;
    接收所述调试宿主机经由所述ADB连接发送的通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据,对所述接收的调试数据进行调试。
  16. 根据权利要求15所示的远程调试方法,其中,所述建立与调试宿主机之间的ADB连接还包括:
    检测USB端口连接的调试宿主机,与所述调试宿主机通过USB建立ADB连接。
  17. 一种远程调试装置,包括处理器和存储器,所述处理器能够运行所述存储器上的各个功能模块中的计算机可执行指令,所述存储器上的功能模块包括:
    ADB连接建立模块,建立与调试宿主机之间的ADB连接;
    ADB检测指令发送模块,发送ADB检测指令给所述调试宿主机,以使所述调试宿主机确定手机上运行的目标应用程序,所述调试宿主机还用于在所述手机上安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核,通过所述网页视图调试内核解析所述目标应用程序的网页视图中展示的网页;
    调试模块,接收所述调试宿主机经由所述ADB连接发送的通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据,对所述接收的调试数据进行调试。
  18. 根据权利要求17所述的远程调试装置,其中,所述ADB连接建立模块,检测USB端口连接的调试宿主机,与所述调试宿主机通过 USB建立ADB连接。
  19. 一种远程调试方法,包括:
    调试宿主机建立与调试主机之间的ADB连接;
    所述调试宿主机接收ADB检测指令,根据所述ADB检测指令确定待调试的目标应用程序;
    所述调试宿主机下载并安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核;
    所述调试宿主机通过所述目标网页视图调试内核开启所述目标应用程序的调试开关,解析所述目标应用程序中展示的网页视图,并通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据经由所述ADB连接发送给所述调试主机的桌面调试工具进行调试。
  20. 根据权利要求19所述的远程调试方法,其中,所述调试宿主机建立与调试主机之间的ADB连接还包括:
    所述调试宿主机检测USB端口连接的调试主机,通过所述USB端口与所述调试主机建立所述ADB连接。
  21. 根据权利要求19所述的远程调试方法,其中,所述调试宿主机下载并安装预设的目标网页视图调试内核之前还包括:
    所述调试宿主机判断所述目标应用程序是否实现了与所述目标网页视图调试内核对应的调试接口,若是,则执行下载并安装预设的目标网页视图调试内核。
  22. 根据权利要求21所述的远程调试方法,其中,所述调试宿主机判断所述目标应用程序是否实现了与所述目标网页视图调试内核对应的调试接口之后还包括:
    所述调试宿主机在所述目标应用程序实现了与所述目标网页视图调试内核对应的调试接口时,判断所述目标应用程序是否包含扫码打开页 面功能,若包含,则通过扫描二维码打开与所述目标应用程序的调试开关开启的操作页面,获取通过所述操作页面输入的确认指令,根据所述确认指令开启所述目标应用程序的调试开关。
  23. 根据权利要求19所述的远程调试方法,其中,所述调试宿主机下载并安装预设的目标网页视图调试内核之前还包括:
    所述调试宿主机判断所述目标应用程序是否包括已安装网页视图调试内核;
    若所述目标应用程序包括所述已安装网页视图调试内核,则所述调试宿主机获取所述已安装网页视图调试内核作为目标网页视图调试内核,并执行所述通过所述网页视图调试内核开启所述目标应用程序的调试开关;
    若所述目标应用程序未包括所述已安装网页视图调试内核,则所述调试宿主机执行所述下载并安装预设的网页视图调试内核。
  24. 根据权利要求23所述的远程调试方法,其中,所述调试宿主机判断所述目标应用程序是否包括已安装网页视图调试内核之后还包括:
    所述调试宿主机在所述目标应用程序包括已安装网页视图调试内核时,确定与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号;
    所述调试宿主机在与所述已安装网页视图调试内核对应的版本号不低于所述目标网页视图调试内核对应的版本号时,获取所述已安装网页视图调试内核作为所述目标网页视图调试内核,并执行所述通过所述目标网页视图调试内核开启所述目标应用程序的调试开关的步骤;
    所述调试宿主机在与所述已安装网页视图调试内核对应的版本号低于所述目标网页视图调试内核对应的版本号时,执行所述下载并安装预设的目标网页视图调试内核。
  25. 根据权利要求19所述的远程调试方法,其中,所述调试宿主机下载并安装预设的目标网页视图调试内核还包括:
    所述调试宿主机下载并安装预设的与所述调试主机的桌面调试工具对应的调试工具客户端,所述调试工具客户端包括所述预设的目标网页视图调试内核。
  26. 一种远程调试方法,包括:
    调试主机建立与调试宿主机之间的ADB连接;
    所述调试主机发送ADB检测指令给所述调试宿主机,以使所述调试宿主机确定手机上运行的目标应用程序,所述调试宿主机还用于在所述手机上安装预设的目标网页视图调试内核,所述目标网页视图调试内核中包含有解析网页元素的webkit内核,通过所述网页视图调试内核解析所述目标应用程序的网页视图中展示的网页;
    所述调试主机接收所述调试宿主机经由所述ADB连接发送的通过所述目标网页视图调试内核将所述目标应用程序中展示的网页视图的调试数据,对所述接收的调试数据进行调试。
  27. 根据权利要求26所示的远程调试方法,其中,所述调试主机建立与调试宿主机之间的ADB连接还包括:
    所述调试主机检测USB端口连接的调试宿主机,与所述调试宿主机通过USB建立ADB连接。
  28. 一种计算机存储介质,其上存储有计算机可执行指令,该计算机可执行指令被处理器执行时实现权利要求1-7任一项所述的方法步骤,或者权利要求15-16任一项所述的方法步骤。
PCT/CN2017/115342 2016-12-13 2017-12-08 一种远程调试方法及装置、计算机存储介质 WO2018108041A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611146675.2 2016-12-13
CN201611146675.2A CN108614767A (zh) 2016-12-13 2016-12-13 一种远程调试方法及装置

Publications (1)

Publication Number Publication Date
WO2018108041A1 true WO2018108041A1 (zh) 2018-06-21

Family

ID=62557920

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/115342 WO2018108041A1 (zh) 2016-12-13 2017-12-08 一种远程调试方法及装置、计算机存储介质

Country Status (2)

Country Link
CN (1) CN108614767A (zh)
WO (1) WO2018108041A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110119352A (zh) * 2019-04-18 2019-08-13 深圳壹账通智能科技有限公司 应用程序的ui调试方法、装置、计算机设备和存储介质
CN111124702A (zh) * 2019-11-22 2020-05-08 腾讯科技(深圳)有限公司 性能数据采集方法、装置和计算机可读存储介质
CN111124874A (zh) * 2018-10-31 2020-05-08 阿里巴巴集团控股有限公司 调试网页的方法、调试服务器以及主控设备
CN113760706A (zh) * 2020-09-17 2021-12-07 北京沃东天骏信息技术有限公司 网页调试方法及装置
CN115470423A (zh) * 2022-11-15 2022-12-13 深圳市乐凡信息科技有限公司 安卓系统的更新方法、装置、设备及存储介质

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109508287A (zh) * 2018-10-16 2019-03-22 平安普惠企业管理有限公司 页面调试方法及终端设备
CN110058994B (zh) * 2019-03-01 2023-09-12 视联动力信息技术股份有限公司 一种调试安卓医疗终端中程序的方法以及系统
CN111078530A (zh) * 2019-11-22 2020-04-28 北京奇艺世纪科技有限公司 应用程序调试方法、系统、电子设备及计算机可读存储介质
CN111444103B (zh) * 2020-03-31 2024-04-26 腾讯音乐娱乐科技(深圳)有限公司 一种Web页面自动化测试方法及相关设备
CN113760688B (zh) * 2020-06-05 2024-07-19 腾讯科技(深圳)有限公司 一种远程调试方法、系统、网页服务器、设备及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104021082A (zh) * 2014-06-16 2014-09-03 贝壳网际(北京)安全技术有限公司 一种针对浏览器的远程调试方法及装置
CN104424093A (zh) * 2013-08-26 2015-03-18 阿里巴巴集团控股有限公司 一种兼容性测试方法及系统
US9170922B1 (en) * 2014-01-27 2015-10-27 Google Inc. Remote application debugging

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424093A (zh) * 2013-08-26 2015-03-18 阿里巴巴集团控股有限公司 一种兼容性测试方法及系统
US9170922B1 (en) * 2014-01-27 2015-10-27 Google Inc. Remote application debugging
CN104021082A (zh) * 2014-06-16 2014-09-03 贝壳网际(北京)安全技术有限公司 一种针对浏览器的远程调试方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"Edge Tool for Tbs Exploitation and Debugging", TBS STUDIO, 30 November 2016 (2016-11-30), Retrieved from the Internet <URL:http://open.imtt.qq.com/thread-1416927-1-1html> *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124874A (zh) * 2018-10-31 2020-05-08 阿里巴巴集团控股有限公司 调试网页的方法、调试服务器以及主控设备
CN111124874B (zh) * 2018-10-31 2024-04-05 阿里巴巴集团控股有限公司 调试网页的方法、调试服务器以及主控设备
CN110119352A (zh) * 2019-04-18 2019-08-13 深圳壹账通智能科技有限公司 应用程序的ui调试方法、装置、计算机设备和存储介质
CN111124702A (zh) * 2019-11-22 2020-05-08 腾讯科技(深圳)有限公司 性能数据采集方法、装置和计算机可读存储介质
CN111124702B (zh) * 2019-11-22 2023-03-21 腾讯科技(深圳)有限公司 性能数据采集方法、装置和计算机可读存储介质
CN113760706A (zh) * 2020-09-17 2021-12-07 北京沃东天骏信息技术有限公司 网页调试方法及装置
CN113760706B (zh) * 2020-09-17 2024-05-17 北京沃东天骏信息技术有限公司 网页调试方法及装置
CN115470423A (zh) * 2022-11-15 2022-12-13 深圳市乐凡信息科技有限公司 安卓系统的更新方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN108614767A (zh) 2018-10-02

Similar Documents

Publication Publication Date Title
WO2018108041A1 (zh) 一种远程调试方法及装置、计算机存储介质
US10977100B2 (en) Method and system for automated agent injection in container environments
CN109344065B (zh) 远程调试方法、调试服务器及目标机
US9021443B1 (en) Test automation API for host devices
US8677321B2 (en) User-space probe based debugging
WO2016177341A1 (zh) 接口调用方法、装置及终端
CN110780930B (zh) 启动Android系统的方法、装置、电子设备及存储介质
US8539506B2 (en) Dynamic injection of code into running process
US10042744B2 (en) Adopting an existing automation script to a new framework
US9122793B2 (en) Distributed debugging of an application in a distributed computing environment
CN111382048B (zh) 真机测试平台上移动设备的管理方法和装置
TW201416977A (zh) 頁面返回方法,頁面生成方法和裝置
CN109873735B (zh) H5页面的性能测试方法、装置和计算机设备
CN110955409B (zh) 在云平台上创建资源的方法和装置
WO2016095570A1 (zh) 一种嵌入式系统的调试方法及装置、存储介质
US9378054B2 (en) Testing system with methodology for background application control
CN106528415A (zh) 一种软件兼容性测试方法、业务平台及系统
CN108121650B (zh) 一种对于页面用户界面的测试方法及装置
CN110825370A (zh) 移动端应用开发方法、装置及系统
CN109032705B (zh) 应用程序的执行方法、装置、电子设备及可读存储介质
CN107918587B (zh) 一种应用程序的调试方法及系统
CN112115056B (zh) 一种项目部署方法和装置、服务器、存储介质
US20110107311A1 (en) Communicating with Locally Networked Device from Remotely Hosted Browser Based Tool
CN113709243A (zh) 设备远程控制方法及装置、电子设备和存储介质
CN113127329B (zh) 脚本调试方法、装置及计算机存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17882124

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17882124

Country of ref document: EP

Kind code of ref document: A1