Roku App Development: Common Problems & Debugging
Roku App Development: Common Problems & Debugging
With our intense Roku application development, we captured all the common problems and their solutions. Here is a quick list that you can refer as a starting point if you run into an issue.
Debugging Your Application
First, you should learn how to debug a Roku application to begin with. There are a variety of ports available to debug the Roku Channel. Using the debug console and these ports we can debug our Roku channel.The debug console provides a window to show the crash logs, stack-traces and much more during runtime. You can also refer this intense Roku documentation available here
https://sdkdocs.roku.com/display/sdkdoc/Debugging+Your+Application to learn more about debugging.
Accessing the Debug Console
You can easily connect with debugging console of your application, by using a standard shell provided on your computer’s OS and Telnet client application.
Open a Console
To access the console for your application, open up a terminal shell application, for example, one of the following:
- On Windows, All Programs -> Accessories -> Command Prompt
- On Linux, Gnome or other terminal
- On Mac, Terminal
Type the command
telnet rokuPlayer-ip-address port_number For example:
telnet 192.168.1.100 8085
There are 3 ports used to debug the Roku channel.
- 8080 for debug server, that contains a host of utilities
- 8085 for BrightScript console, that gives access to BrightScript runtime environment
- 8087 for Screensaver, that is starting point for screensavers
Debugging SceneGraph Applications
Additionally, there are some special debugging commands to debug SceneGraph applications. To use these commands you have to open the console and type the commands listed below. Again, to connect to console, fire following line and then fire the relevant commands:
telnet rokuPlayer-ip-address 8080 These commands are:
- sgnodes all: Prints every existing node created by the currently running channel.
- sgnodes roots: Prints every existing node without a parent created by the currently running channel.
- sgnodes node_ID: Prints nodes with an id field set to node_ID, except it bypasses all the hierarchy and rules, and just runs straight down the whole list in the order of node creation.
- loaded_textures: Display the current set of images loaded into texture memory.
- sgversion [default | force ]: When the 1st parameter is the default, it sets the default rsg_version of a channel when it is not specified in the manifest.
You can find more about these commands here:
Troubleshooting Common Development Errors
There are several very common errors during the SceneGraph application development. Here are a few that we encountered very frequently.
This error occurs because of BrightScript variable has been incorrectly spelled after it has been declared, never declared at all, or declared as a local variable in another function. In the debug console show the local variable used at the time of the error and variable listed as uninitialized. To solve this error you have to declare the variable or variables listed earlier in the application prior to the message and correct the spelling, or declare then correctly, or declare the variable using the m object reference which gives the variable file scope.
‘Dot’ Operator attempted with invalid BrightScript Component or interface reference
This error occurs because of a component by that name has either not been created, or an attempt is made to access a component member using an incorrectly spelled component name. In the debug console show the component objects and variables used at the time of the error, and note the component objects listed as invalid. To solve this error you have to correct the mismatch between the component name and the component object creation function argument and Correct the case-sensitive spelling of the component name either in the component file, or at the point where you attempted to create the component object.
Graphic Image Does Not Appear, Question Mark Appears Instead of Image
This error occurs because of the graphic image file was not found in the location specified in the application. In the debug console show the graphic image does not found or path not found. To solve the error you have to check that graphic image file is in the specified location or the path and file name spelling to ensure that the correct graphic image appears.
List or Grid Fails to Appear, or First Item is Blank or Missing Information
This error occurs because of the ContentNode node assigned to the content field of the list or grid either does not exist, or was assigned after focus was set on the list or grid. To solve this error you have to check that the ContentNode node has been created successfully at the time it is assigned to the list or grid content field and set the focus on the grid or list after the content field is assigned a valid ContentNode node.
Execution timeout (runtime error &h23)
This error occurs because of time consuming calculation and more recursive call. In the debug console show the line number at which the error is detected will be flagged with an asterisk, and the message will provide the name of the function. There is a way you can achieve multithreading (only in the essence not actually), ie task node (read roku SDK for more info). To solve this error you have to create the task node and give the work of heavy calculation operations in task node.
Stack Overflow. (runtime error &hdf)
This error occurs because of exceeding the stack size. To solve this error you have to reduce the recursive call.
Please find a few Roku applications, that we developed in recent times: