uncaught reference error jQuery is not defined

Viewed 1097

I load my index.html from my android app which is built using Cordova. I have included my jquery file correctly, but I still get the error uncaught reference error jQuery is not defined.

     <html>
        <head>
            <title id="title" name="title"></title>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
            <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />        
            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> 
            <script type="text/javascript" src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
           <script type="text/javascript" charset="utf-8" src="../abc/js/mydevice.js"></script> 
           <script type="text/javascript" charset="utf-8" src="cordova.js">/script>
           <script type="text/javascript">
                (function($) {                  
                   $(document).ready(function() {             
                       document.addEventListener("deviceready", onDeviceReady, false);                                                    
                   });
                })(jQuery);

            </script>

        </head>
    <body>
    </body>
    </html>

I get the error Uncaught Reference error jQuery is not defined from document ready function. I get the same error from mydevice.js file.

mydevice.js file looks like below

jQuery(document).ready(function(){
  /// body of the function here.....
});

My java code to launch index.html looks like below

public class AppActivity extends CordovaActivity
{
    public static final String INDEX_FILE_PATH = "file:///android_asset/www/index.html";

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // super.loadUrlTimeoutValue = 1000 * 60;
        super.init();
        // super.loadUrl(INDEX_FILE_PATH);
        loadUrl(launchUrl);              
    }
}

I have gone through this link uncaught reference error. Not sure what I am missing?

I found out, I get this error when I am using a proxy on my WIFI in android simulator. If I don't use that proxy, I don't get this error.

1 Answers
Related