Debug an Application
Estimated reading time: 3 minutes
This document describes how to debug an application.
Debug on BRAVIA Professional Display
BRAVIA Professional Display supports some debug features. You need to connect to your display first.
Connect to BRAVIA Professional Display
Note: For Development and Debugging on Android devices
- Activate Android Developer Options:
- If you want to use the Android
adb
command on BRAVIA Professional Display, you need to activate Android Developer Options on BRAVIA Professional Display in the same way as other Android devices. Turn the option off when not in use. In general, it should be disabled on your production environment to avoid any trouble. Please refer the details of the Android Developer Options in Android Developer Site.- You can use the
adb
command via Ethernet and Wi-Fi. The command cannot be used via USB cable.
-
Install and set up the Android
adb
command on your PC. -
Connect to BRAVIA Professional Display with the Android
adb
command on your PC. The connection must be via Ethernet or Wi-Fi. USB connection is not supported.$ adb connect <BRAVIA Professional Display IP Address>
Log
BRAVIA Professional Display supports console log.
- Connect to your BRAVIA Professional Display in advance.
- Start capturing log.
$ adb logcat -c # clear log buffers $ adb logcat -v time # capture $ adb logcat -v time > log.txt # ">" (redirect) is also available to save data.
- Stop : Control + c
Note: Logcat shows not only
javascript console.log()
but also other system logs.
Remote Debug
BRAVIA Professional Display supports remote debug feature. In your PC browser, you can easily debug an application running on BRAVIA Professional Display.
WebAppRuntime v1.4.10. or later
- Connect to your BRAVIA Professional Display in advance.
- Launch WebAppRuntime and set the URL of your own HTML5 application to start the remote debug function.
$ adb shell am start -a android.intent.action.VIEW -n com.sony.dtv.browser.webappruntime/.WebAppRuntimeActivity --es uri <HTML5 application url> -e args '--remote-debugging-socket-name=tvsdk-debugging-socket'
- Launch your PC Chrome browser and select "Developer Tools".
- In "Remote devices", you can see your display’s model name.
- Select your display’s model name and click "Inspect" button. Then a new DevTools instance opens.
WebAppRuntime v1.3.22. or earlier
- Connect to your BRAVIA Professional Display in advance.
- Start the remote debug function on your PC.
$ adb shell am start -a android.intent.action.VIEW -n com.sony.dtv.browser.webappruntime/.WebAppRuntimeActivity -e args '--remote-debugging-socket-name=tvsdk-debugging-socket' $ adb forward tcp:9222 localabstract:tvsdk-debugging-socket
- Connect to the URL
http://localhost:9222
on your PC browser. - You can find the debug information on your PC browser. And you can also view console log with this tool.
Cache Mode Customization
The cache mechanism is useful in many cases. However developers sometimes do not want to it in web development phase. manifest.json
provides a way to disable that function.
To remove cached images and files in each page transition or reloading, the "cache_files_and_images"
property should be set as false
in manifest.json.
"cache_files_and_images"
:
true
: Enable to cache images and files. The default value istrue
.false
: Disable to cache images and files.
{
"app": {
"cache_files_and_images" : false // Disable cache mechanism
}
}