【问题标题】:fresh start issues in phonegapphonegap 中的新开始问题
【发布时间】:2014-04-02 10:09:23
【问题描述】:

我是 Phonegap 的新用户,我很困惑一切是如何运作的。我在c://ProjectName 上创建了该项目并为android 构建了它。我打开我的 ADT (Eclipse) 并从现有代码创建一个项目,然后我有两个项目文件夹:ProjectName 和 ProjectName-CordovaLib。

  • 第一个问题: 什么是 ProjectName-CordovaLib?我是否需要在该文件夹中编写代码?
  • 第二个问题: 我在 ProjectName>www 文件中,我熟悉作为网络程序员。 CSS JS IMG 和 html 文件。

当我修改 index.html 文件并在模拟器中运行应用程序时,它似乎没有任何效果。在 ADT 中,自动重建选项被选中。我怎样才能修改文件? 在:ProjectName.java

public class ProjectName extends CordovaActivity 
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.init();
        // Set by <content src="index.html" /> in config.xml
        super.loadUrl(Config.getStartUrl());
        super.loadUrl("file:///android_asset/www/index.html");
    }
}

我认为这些是我目前的问题。你能帮我吗? 我的 index.html 文件(已修改):

<!DOCTYPE html>
<!--
    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" />
        <!-- 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>MY APP</title>
    </head>
    <body>
        <div class="app">
            <h1>MY</h1>
            <div id="deviceready" class="blink">
                <p class="event listening">Hi !</p>
                <p class="event received">Hello Sekai</p>
            </div>
        </div>
        <script type="text/javascript" src="phonegap.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
        //there was something here but I deleted it.
        // there was an app.init() 
        </script>
    </body>
</html>

【问题讨论】:

  • 请给我看看index.html文件的代码
  • 我贴出了修改后的index.html
  • 我也将索引重命名为 index1 ,但它并没有提示 not found 错误,但是当我将 super.loadUrl("file:///android_asset/www/index.html"); 更改为 super.loadUrl("file:///android_asset/www/index1.html"); 时它提示了错误。那么,WTF 是 android_asset 吗?不是在我在控制台创建的项目中吗?
  • 你在Eclipse中导入项目吗
  • 这是来自 Google Android 包的 Eclipse 的 android“发行版”,但是是的,它是 Eclipse

标签: android eclipse cordova


【解决方案1】:

第一个答案:ProjectName-CordovaLib 是什么? -> 这是科尔多瓦图书馆。在旧版本中,phongap 将提供 .jar,而现在 3.3.0 版本将提供一个库。

第二个答案:我在ProjectName&gt;www -&gt; 中有在多个平台上使用的基本通用代码,

在 Android 中,您可以在 assets forlder 中看到 www。如果不是,请阅读“_where-is-www.txt”文件并按照说明进行操作。

【讨论】:

  • 请再参考问题,我附上了配置图,看不懂里面是什么
  • 您可以选择项目相关路径并删除两者
  • 我不明白,它们已经被排除在外了,我应该删除它们吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多