Start a new topic

"calljavscript" Error !

"calljavscript" Error !

Hello, i am developping a very simple wikitude project that consist on: 

I want to pass the name of a drawable like "sun.png" to a JS method using the calljavascript method and display this image in the ARView, but an error occur when running the project that indicate: ERROR -> connection could not be established 

and the image isn't displayed. Any help?

Android code:


String asset_name = "sun.png";

boolean isLoading = false;

final Runnable loadData = new Runnable() {



public void run() {


isLoading = true;



isLoading = false;




protected void loadData() {

if (!isLoading) {

final Thread t = new Thread(loadData);





private void callJavaScript(final String methodName, final String arguments) {


if (this.architectView != null) {

final String js = (methodName + "( " + arguments + " );");






Do you have a log including stacktrace for this problem?

I can't find any problem in this code, the error could be unrelated to the Javascript call. Is the ArchitectView started? Is the rest of your AR world working?

Have you already tried the standard sample application that comes with the SDK? In the sample "Load POI Data - from application model" we use the Javascript callback function to load the POIs, you can use that as a reference for your code.

Thank's for your answer, but the ArchitectView is started without problem but they can't display the drawable,  and i am using the "Load POI Example" in the sample code.

The logcat indicate that the asset is not found.

If the asset was not found, the problem could be that it's not in the same path as the main HTML file of your AR world.

Could you please post the logcat messages?

These are the logcat messages :

06-03 15:05:23.156: E/libEGL(914): called unimplemented OpenGL ES API

06-03 15:05:23.156: E/libEGL(914): called unimplemented OpenGL ES API

06-03 15:05:23.203: I/dalvikvm-heap(914): Grow heap (frag case) to 8.066MB for 460816-byte allocation

06-03 15:05:23.289: I/dalvikvm-heap(914): Grow heap (frag case) to 8.504MB for 460816-byte allocation

06-03 15:05:25.367: E/Android Callback(914): ERROR -> connection could not be established


The error "Connection could not be established" refers to a network connection used by our SDK, and has nothing to do with the assets you are trying to load.

Since you are using Javascript to load an image file, the file must be in the same path as the other resources. If the file is in another position on the filesystem, the Javascript call will be unable to load it.

Where is your file located?


If your file is not in the same directory as your main HTML file, then you should specify a relative path when loading it. The Javascript code will be exeuted in the same environment.

Try to put your javascript call inside a js file in your AR world. If it doesn't work, then the problem is not the callJavascript function.
Login or Signup to post a comment