Why is cordova.exec() running in my Android PhoneGap (1.7) app before "deviceready"?

android, cordova, jquery-mobile

Solution

I was having the similar issue after spending couple of hours i realized that cordova-1.7.0.js (or phonegap-1.7.0.js in your case) was of the iOS as originally i created project for iOS i replaced this file with the relevant android JS file and it started working.

The cordova-1.7.0.js is different for different mobile platforms, use the correct JS file for particular platform.

Problem

I'm trying to "PhoneGap" (1.7.0) a jQuery Mobile app (1.1.0) I have to create an Android app. However, I keep getting the following alert message. ``` ERROR: Attempting to call cordova.exec() before 'deviceready'. Ignoring. ``` It appears as if this may happen during $.ajax calls, but it difficult to be sure. I'm not making any calls to Cordova functions in my app - it's pure JQM. Any ideas what the problem is. Or, failing that, does anyone know why cordova.exec() might be called during an $.ajax request? I'm running the app under Android 4.0.3, in a virtual device/simulator.

Original source