ArcGIS AppStudio

Introducing New Debugging Tools in AppStudio

With the release of AppStudio for ArcGIS version 4.0, we have added many exciting new features, enhancements and bug fixes to help you create cross-platform native apps easier and faster. Visit the What’s New post to learn about all of the updates. But this blog post is for all the “code ninjas” out there, as we will turn our focus to enhancements we made in AppStudio 4.0 to help our developers seeking more control when writing code and testing apps. The release introduces a new integrated Run button,  QML code debugging, and QML Profiling in the bundled Qt Creator application. These were the most requested features by AppStudio developers, and we are excited to deliver an improved and more comprehensive coding experience.

Integrated Run Button


Seasoned AppStudio developers all know the Alt+Shift+R  keyboard shortcut off the top of their heads, as it becomes second nature.  Edit some code, then a quick Alt+Shift+R  to immediately see your code running in a live app. The alternative to this shortcut is to navigate through the UI menu (Tools > External > AppStudio > Run), this gets old real fast. But in AppStudio for ArcGIS version 4.0 we have enabled the (Green) Run button at the lower left of the Qt Creator window so that you can quickly test and run your apps with a single click. (don’t worry keyboard enthusiast, Alt+Shift+R still works the same)


QML Debugging


The conventional method to debug your AppStudio apps is to use console.log() messaging in your QML code, as these messages are displayed in the Qt Creator console when running the app in AppRun. AppStudio version 4.0 provides a more powerful method to debug your AppStudio app, by giving immediate access to the Qt Creator debugging tools. To open your app in debug mode, either press F5 in Qt Creator, or click the Start debugging of the startup project button at the lower left of the Qt Creator window. See Interacting with the Debugger in the Qt documentation for more information on how to use the debugging tools in Qt Creator.


For AppStudio developers, Qt Creator Debug mode lets you inspect the state of your app while debugging. You can interact with the debugger and interrupt running programs by setting breakpoints, go through a program line-by-line, examine and modify contents of local and global variables, and disassemble sections of code. Qt Creator displays the raw information provided by the native debuggers in a clear and concise manner with the goal to simplify the debugging process as much as possible. You can also use the Debug mode views to examine the data in more detail.


QML Profiling


QML Profiler is a very useful tool to find the causes for typical performance-related problems in your app, such as slowness and unresponsive, stuttering user interface. Typical causes include executing too much JavaScript code in a short amount of time. To monitor the performance of AppStudio apps in the QML Profiler, select Analyze > QML Profiler to the profile of the current application in Qt Creator bundled in AppStudio for ArcGIS. When you start analyzing an app, the app is launched, and the QML Profiler immediately begins to collect data. This is indicated by the time running in the Elapsed field. Data is collected until you close or exit the app.


Data is displayed in three separate tabs: Timeline, Flame Graph and Statistics. The Timeline view displays the graphical representation of QML and Javascript execution and a condensed view of all recorded events. Events in the Timeline view generally indicate how long the QML or JavaScript execution took. Move the mouse over them to see details. For most events, it includes location in the source code, duration and some relevant parts of the source code itself. The Flame Graph view shows a more concise statistical overview of QML and JavaScript execution, the horizontal bars show the amount of time all invocations of a certain function took together, relative to the total runtime of all JavaScript and QML events. The Statistic view displays the number of times each binding. create, compile JavaScript, or signal event is triggered and the average time it takes. This allows you to examine which events you need to optimize.  See Profiling QML Applications > Analyzing Collected Data in the Qt documentation for more information on collected data.


We hope you like these new features added to the Qt Creator bundled in AppStudio for ArcGIS.

About the author

Erwin is a Product Engineer for AppStudio for ArcGIS in Redlands, California. During working hours, he loves helping people create cross-platform native apps. Outside working hours, he spends a lot of hours running in the mountains of San Gorgonio and Angeles National Forest.


Next Article

New version of the ArcGIS Pro Performance Assessment Tool (PAT) is now available!

Read this article