# Where can I find cordova.js?
- Cordova.js is a very important JavaScript file within Cordova/PhoneGap.
- It allows you to access the hardware of your Android device via plugins.
IMPORTANT
Most plugins will ALMOST NEVER work if the link to cordova.js is missing!
<body>
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
<script src="cordova.js"></script>
<script src="js/index.js"></script>
</body>
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
- Examine the structure of the starting project (and of all the examples that follow).
- In the code, the file cordova.js is on the same level as index.html.
- As you can see, this file does not exist at all and you should not add it yourself!
- Every time you compile the app for the browser or for Android, the compiler will add the cordova.js file to the project itself.
- Cordova.js will contain the same functions for each platform, but the content of the functions are different!
# phonegap serve
- Open the platforms/browser/www folder.
- Here you will find a copy of the original project, plus some additional files including cordova.js.
# cordova run android
- In the console you find the path to the compiled apk file.
- Duplicate app-debug.apk to the desktop.
- Change the extension .apk to .zip.
- Unzip the app-debug.zip file and examine its contents.
- Here you will find a copy of the original project, plus some additional files including cordova.js.
TIP
- Now open both cordova.js files and you will notice that the content is different.