Android"[ERROR]初始化Cordova时出错:找不到类" [英] Android “[ERROR] Error initializing Cordova: Class not found”

查看:74
本文介绍了Android"[ERROR]初始化Cordova时出错:找不到类"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用phonegap-2.9.0

I am using phonegap-2.9.0

我从android/example/res/复制了xml文件夹并将其粘贴到/res

I copied xml folder from android/example/res/ and paste it into /res

还是我在模拟器屏幕上收到了警报

Still i am getting following alert in emulator screen

"[ERROR] Error initializing Cordova: Class not found"

查看屏幕截图

我的index.html代码:

my index.html code:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" href="css/jquery.mobile-1.3.1.min.css">
<script src="cordova.js"></script>
<script src="js/jquery.js"></script>
<script src="js/index.js"></script>
   <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // device APIs are available
    //
    function onDeviceReady() {
        navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
    }

    // onSuccess: Get a snapshot of the current acceleration
    //
    function onSuccess(acceleration) {
        alert('Acceleration X: ' + acceleration.x + '\n' +
              'Acceleration Y: ' + acceleration.y + '\n' +
              'Acceleration Z: ' + acceleration.z + '\n' +
              'Timestamp: '      + acceleration.timestamp + '\n');
    }

    // onError: Failed to get the acceleration
    //
    function onError() {
        alert('onError!');
    }

    </script>




</head>
<body >
<center>
  <img src="img/full_logo.png">
</center>
<div style="width:100%;text-align:center">
  <input type=button value="Today" onClick="getdata('today');">
</div>
<br/>
</body>
</html>

请检查我的html代码.

Please check my html code.

推荐答案

我认为您尚未在项目中添加config.xml文件.这是您应该做的..
1.在项目的res目录中创建一个新的文件夹名称'xml'
2.转到Phonegap文件夹的lib/android/framework/res/xml目录,然后将config.xml文件复制到项目的xml文件夹中.
希望这对您有帮助

I think you have not add config.xml file in your project.Here what you should do..
1. Create a new folder name 'xml' in the res directory of your project
2. go to the lib/android/framework/res/xml directory of the Phonegap folder then copy the config.xml file to your project's xml folder.
I hope this will do for you

这篇关于Android"[ERROR]初始化Cordova时出错:找不到类"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆