The problem was not in JS but in the Java code.
Since my phone has Android 7, the camera permission had to be granted at runtime. I did the requestPermission, but had not called the listener to check if the permission was granted.
So when the runtime permission dialog box popped up, the onPostCreate() was called and architectView was loaded. (without accepting or denying the permission)
Using onRequestPermissionResult(), I made sure that camera permission was granted before calling architectView.onCreate(config) or architectView.load( "url").
Now everything is fine.
So when you tested our sample exactly as we provide it without any changes, you were getting the same experience? If so, could you please send over your AR experience (.html, .css, .js files, assets, target images) so we can test internally? Also, please provide details of the phone you are testing with.
I tried replacing my code with '01_ImageTracking_1_ImageOnTarget' sample in the assets folder. On the first run it displays 'Loading ...' and nothing else. On closing the app and launching it again it works fine.
I assume the .js files are not loaded on first run. Please help.