初始化Cordova时出错:找不到类 [英] Error initializing Cordova: Class not found
问题描述
我按照从Phonegap.com官方网站(Android入门)的Phonegap教程。
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.
- 从DroidGap扩展,并从onCreate()添加loadURL方法。
- 在相应的文件夹中添加cordova-2.0.0.js和cordova-2.0.0.jar。 添加了jar文件到构建路径
- 从html标签加载js文件
- 添加权限从AndroidMainfeast.xml
- 复制了包含configs.xml的xml文件夹
- created activity and extended from "DroidGap" and added loadURL method from onCreate().
- Added cordova-2.0.0.js and cordova-2.0.0.jar on the respective folder.
- Added the jar file to the build path
- Loaded the js file from the html tag
- Added permissions from AndroidMainfeast.xml
- copied the xml folder containing "configs.xml"
我不明白问题在哪里。它显示以下错误,如截图所示
Now I don't understand where's the problem. It is showing the below error as shown in the screenshot
这是我的HTML文件
<!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>
有任何建议吗?感谢!
推荐答案
这是 config.xml
不是 configs.xml
。
根据纪录,我发现您在应用程式中缺少这个档案 res / xml
目录。它包含在 lib / android / res / xml / config.xml
中,因此将该文件复制到 res / 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.
这篇关于初始化Cordova时出错:找不到类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!