I followed the tutorial of Phonegap from the official Phonegap.com site (getting started with Android).
I have created project with following all the steps.
Now I don't understand where's the problem. It is showing the below error as shown in the screenshot
Here is my HTML file
<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
// Empty
}
// Show a custom alert
//
function showAlert() {
navigator.notification.alert(
'You are the winner!', // message
'Game Over', // title
'Done' // buttonName
);
}
// Beep three times
//
function playBeep() {
navigator.notification.beep(3);
}
// Vibrate for 2 seconds
//
function vibrate() {
navigator.notification.vibrate(2000);
}
</script>
</head>
<body>
<p><a href="#" onclick="showAlert()">Show Alert</a></p>
<p><a href="#" onclick="playBeep()">Play Beep</a></p>
<p><a href="#" onclick="vibrate()">Vibrate</a></p>
</body>
</html>
Any advice? Thanks!
It is config.xml
not configs.xml
.
Based on the logs I'm seeing you are missing this file in your apps res/xml
directory. It is included as part of the distribution at lib/android/res/xml/config.xml
so copy that file into your res/xml
directory and you should be all set.
Just as aharris88 in his answer to this question, I had the [CORDOVA] Error initilizing Cordova: Class not found
error message when using Cordova 3.1.0 on my Android dev phone after migrating from Phonegap 3.0.
All fiddling with the config.xml
file in the /platforms/android/res/xml
directory did not help. Based on the Stackoverflow answer mentioned above, I tried to "start over" by reinstalling Android platform support:
cordova platform rm android
cordova platform add android
After this step it worked again, and I was able to cordova build android && cordova run android
without any further problems.
I have had this error because of a plugin that I deleted. I Added
<plugin name="Device" value="org.apache.cordova.Device"/>
to the config.xml file again and it fixed it.
My you not have following plugin:
<plugin name="Device" value="org.apache.cordova.Device"/>
You have to put that in between <plugins></plugins>
.
like
<plugins>
<plugin name="Device" value="org.apache.cordova.Device"/>
</plugins>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With