How to use Debug Option for an appk/app (even see logs)?

I was trying to run the debug mode of my app on the Volt MX app. However, it seems that the normal Volt MX app is different from its debug counterpart. Within the Volt MX app, there is an option to download the debug Volt MX app that takes me to this page: https://download.hclvoltmx.com/onpremise/apps/appviewer/9.2.0/AppViewer-Debug_920.apk

which says that the page is under construction.

May I know how long will it take to restore the page and make the debug volt mx available?

Hi @Vishal Vats

Thanks for posting the question in this forum.

As of now we are checking internally when this link will be active again. But you can also view the app in the debug mode using chrome browser. After building the native Android app in Iris.

1. From Iris Top menu-->Debug-->Debut Native app-->Andorid devices/simulators--> Once you click this option it will ask whether you have already build the app .

2.You have to click yes and then Iris will provide you the debug URL of this app. Ex:
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:

3. You need to place the URL in the chrome browser and initially it will not show anything but now you have to run the app directly in the device and then it will show the voltmx debugger configuration and you have to click start

4. Once you start then you can comeback to the chrome browser and refresh the URL where now you can find all the options to debug the app directly from the chrome browser.

Please find below documentation for the same

https://opensource.hcltechsw.com/volt-mx-docs/docs/documentation/Iris/iris_user_guide/Content/Inline_Debugger.html#debug-javascript-for-android-in-volt-mx-iris

@Murali Boddeda, after a bit of tinkering I have found the correct way of doing it. So, first I have to enable the USB debugging mode for the device, and then build the native app in the debug mode. And make sure that I provide the correct code at the time of running the debug apk so that the chrome dev tools get connected to the device.

Just a small question: What can I use to log out the information in debug mode? I guess, voltmx.print does not work.

Hi @Vishal Vats Thanks for the response.

Please confirm do you want to see the logs once you run the application in Android device and all the statements it is printing for your application using debug apk?

Yes, I want to see those. I guess, I cannot use the console.log in a Volt MX app, even after using voltmx.print, nothing is showing up in the Chrome debug window.

@Vishal Vats Thanks for the response.

In order to see the print statement while debugging Android application you need to perform additional configuration.You need to install Android platform tools where it will allow you to see the logcat logs of android devices and can view all the print statements in those logs. You can follow below steps to perform the same.

Topic name is Configure Android SDK

https://opensource.hcltechsw.com/Volt-MX-Documentation-Archive/docs/documentation/Iris/iris_user_guide/Content/AndroidUSBDebugging_Windows10.html

That seems a lot, I guess I can still go on with just the debug mode and will not print out the statements. Thanks for helping me out

@Vishal Vats Thanks for the immediate response. Can you kindly mark the answers as Helpul or Mark as correct Answer.

Hi, @Murali Boddeda. After following the article's instructions, I installed the emulator and am now able to view the debugging stuff (completely alien stuff to me). In my volt mx application, I have written this line:

voltmx.print("Here is the okhttp3 stuff 👇");

So, will that print out the stuff in the emulator or do I have to try something else?

Also, please tell me a filter that I can use to grab the logs that would be generated via the volt mx apk because there is contact stuff coming up on that emulator as a ton of things going on concurrently.

@Vishal Vats Yes in the logcat logs the print statements get printed.You can copy the entire logs in a notepad and search the print statements.

Sir, I asked you whether by using voltmx.print can I get the logs in the emulator, because I am unable to spot those. I asked you for the filters that I could use to get those logs!

Yes Vishal the statements gets printed hence instead of using those filters you can copy the entire logcat logs instead of filtering them and copy paste them in a notepad and then search for those print statements.

For example I have printed this statements in a function

function regSuccessCallback(regId) {
voltmx.print("** JavaScript regSuccessCallback() called **"+regId);
subscribeKMS ( regId );

When I run the same and collected the adb logs I could find those statements as below

09-13 09:10:34.916 22200 22239 D KONYJNI : KonyJSObject.cpp :: KonyFunction_executeJS(ENTER){
09-13 09:10:34.916 22200 22239 D KONYJNI : ***** Executing Javascript function : [ regSuccessCallback ]
09-13 09:10:34.916 22200 22239 D StandardLib: ** JavaScript regSuccessCallback() called

If you filter them with verbose,error etc you might not find those statements.

1 Like

Thanks for your reply. By the way, I don't think that copying the entire logcat file and searching the same is a good thing, because the emulator just provides the best and easiest way to do so by filtering out the logs. Whatever is seen after running the command adb logcat is coming from the emulator itself.

Even in the snippet that you provided, it mentions that this information comes under the debug filter (denoted by the type D).

The logs are coming for the alert box that is being created in the application, but there is no trace of the voltmx.print thing.

You know, while doing this, what I found. We do not need this external platform tool & emulator to see the logs. Just the Chrome debugging session is enough and is way more useful and powerful. Here are the steps that I followed:

1. Create the debug-apk of the project

2. Transfer it to the testing Android device, and enable the USB-debugging option on that device.

3. Start the debugging session from the IRIS app (Debug -> Debug Native App -> Android Devices/Simulators), which gives me a Chrome debug session URL (have the port also appended)

4. Open the app on the device and click on start the debug session (make sure that the port number is the same as that of the chrome debug session)

5. You can refresh the Chrome debug session so that the device and the Volt Iris app can sync together.

6. Once the debug session is active, you will see on the app screen that nothing loads up. That is because the debugger session pauses the execution of the app in the startup.js file. Click on the resume button (which is at the bottom of the RECORDER text)

That will load up the application on the device.

7. After that, your all of the controller js files will be shown in the debugger. You can go inside any of the files, and add a console.log statement wherever needed. For instance, I added this statement in the landingPageController

Save it, by pressing Ctrl+S. Once you do that, you can see a warning dagger which shows that this file is changed in the console, and the actual app code differs.

Now, whenever this file is run again, you will see the console statement in the console section



So, in this way you can just use chrome debugger to efficiently see the logs (because if some external libraries are used in the code, then the debugger session in the preview mode doesn't work)

I hope that this will help someone trying to use debugging for an app 🫡

@Analyn Policarpio @Nina Brown can you mark my above post as the solution for my query!

@Analyn Policarpio @Nina Brown @Cerlina Aragon can you please mark my answer as the response to this query?

@Analyn Policarpio @Nina Brown could you please mark my above thread as the response of this query, so that others could be benefitted

@Vishal Vats, your reply has been marked correct. Thanks!

1 Like

Thanks for doing that :victory_hand: