Cordova – Javascript Function is not defined but it is

In my Cordova project I tried to put all the Javascript code in one file, so at the end of the file I have the following code:

function deviceStart(){
  // stuff to make when the device is ready
}

var appInit = {
  initialize: function() {
    this.bindEvents();
  },
  bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
  },
  onDeviceReady: function() {
    alert("Start");
    try {
      deviceStart();
    } catch(err) {
      alert("error index:"+err);
    }
  }
};

And in the index.html file I have the following:

<script type="text/javascript" src="index.js"></script>
<script type="text/javascript">
  appInit.initialize();
</script>

I receive the following error:

Reference error: deviceStart() is not defined

How can that be possible?

And this problem is only on Android API 22. But in API 24 it is working fine.

Please help!