Testing JavaScript on an Android device

I am learning JavaScript from the site http://www.codecademy.com and so far that’s going alright.


When I enter the line of code:

console.log(“text”); on that website, I get the “text” printed to the screen.

When I enter this into my Android app “JavaScript Development” I get the error message…

Error: ReferenceError: Can’t find variable: console

Any idea what I’m missing?



You are basically saying nothing if there is no variable called console and if console doesnt have a function log, you will get another error.

In Unity you can use Debug.Log or print (neither will print to the screen, but rather to the console). You will not see this in an Android App.

Look into OnGUI() or using GUIText or TextMesh.

Whatever you are looking at on this other page is unrelated to unity most likely(other than learning proper syntax and how code works in general). Try using one of the unity tutorials.

You need to use Debug.Log.

The only way you’re going to ‘see’ this output on an Android device is to use the LogCat profiler or install Eclipse and get that setup correctly to do your logging.

Then any errors or Debug.Log information will be shown through these programs as they occur.