javascript – androidInterface is not defined. What gives?-ThrowExceptions

Exception or error:

I’m seeing a strange javascript exception being triggered by a random user on an android device running chrome. My code contains no reference to anything named androidInterface, and so is not relevant to this question.

User Agent String:

Mozilla/5.0 (Linux; Android 7.0; SM-G892A
Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0
Chrome/57.0.2987.132 Mobile Safari/537.36

…which tells me that the user is running Chrome 57 on Android (Nougat)
on a Samsung SM-G892A

The actual error is coming back from window.onError with
Uncaught ReferenceError: androidInterface is not defined

Also I track clicks and api calls. This error occurs right as they are loading the page which is just a standard backbone/require setup that is working for a few thousand other customers.

Have you ever seen anything like this? What does it even mean?

How to solve:

If you look closely at the UA string, you’ll see wv which means it’s a WebView on Android.

I found this question which made it more clear it’s a WebView and then looked at Chrome User Agent Strings to make sure.

Bottom line is that you don’t have to change anything because the error is related to the app that implemented the WebView.

###

Try running a search over your node_modules folder to see if you can find a reference to androidInterface. If you’re using third party libraries, it’s possible that the reference can be found here.

Leave a Reply

Your email address will not be published. Required fields are marked *