各地的手机错误

时间:2015-09-25 18:29:08

标签: android cordova phonegap-plugins phonegap-build

我试图通过构建带有phonegap的示例移动应用程序来开始

我已经安装了所需的一切。

当我运行phonegap create时,它会创建许多我尚未在任何教程中看到过的文件。

我使用的是5.3.5版本

我已使用sudo npm install -g phonegap

安装了它

我做了什么

我已将示例应用程序上传到github并从.git链接构建。

当我使用qr代码扫描程序将.apk下载到我的android时,它正常安装,我能够连接Device is Ready出现。

但是当我尝试调试时,没有目标。

当我启用Hydration并重新构建时,应用会更新但不再连接到设备。Connecting to Device会出现并且不会离开屏幕。

我所做的唯一更改是config.xml文件添加插件的来源

<gap:plugin name="org.apache.cordova.battery-status" source="npm"/>
<gap:plugin name="org.apache.cordova.camera" source="npm"/>
<gap:plugin name="org.apache.cordova.media-capture" source="npm"/>
<gap:plugin name="org.apache.cordova.console" source="npm"/>
<gap:plugin name="org.apache.cordova.contacts" source="npm"/>
<gap:plugin name="org.apache.cordova.device" source="npm"/>
<gap:plugin name="org.apache.cordova.device-motion" source="npm"/>
<gap:plugin name="org.apache.cordova.device-orientation" source="npm"/>
<gap:plugin name="org.apache.cordova.dialogs" source="npm"/>
<gap:plugin name="org.apache.cordova.file" source="npm"/>
<gap:plugin name="org.apache.cordova.file-transfer" source="npm"/>
<gap:plugin name="org.apache.cordova.geolocation" source="npm"/>
<gap:plugin name="org.apache.cordova.globalization" source="npm"/>
<gap:plugin name="org.apache.cordova.inappbrowser" source="npm"/>
<gap:plugin name="org.apache.cordova.media" source="npm"/>
<gap:plugin name="org.apache.cordova.network-information" source="npm"/>
<gap:plugin name="org.apache.cordova.splashscreen" source="npm"/>
<gap:plugin name="org.apache.cordova.vibration" source="npm"/>

我添加了source="npm"以修正错误。

这是它创建的index.html文件:

<!DOCTYPE html>
<!--
    Copyright (c) 2012-2014 Adobe Systems Incorporated. All rights reserved.

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
        <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" type="text/css" href="css/index.css" />
        <title>Hello World</title>
    </head>
    <body>
        <div class="app">
            <h1>PhoneGap</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 type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
</html>

但我很混淆为什么导入cordova.js文件而不是我在每个教程中看到的phonegap.js文件。

此外,它还会创建一堆文件夹:

--hooks
--platforms
--plugins
--www
config.xml

我与笔记本电脑和Android设备连接在同一个wifi上。

我做错了什么?

0 个答案:

没有答案