【问题标题】:Cordova Unfortunaly, HelloWorld has stoppedCordova 不幸的是,HelloWorld 已停止
【发布时间】:2014-08-19 19:42:18
【问题描述】:

我尝试在 Ubuntu 14.04 中使用 cordova 来创建一个简单的 android 应用程序。我使用

创建了第一个项目

cordova create hello com.example.hello HelloWorld

我添加了android平台,我尝试构建并构建成功,但是当我模拟应用程序时不启动并在屏幕上收到错误

很遗憾,HelloWorld 已停止。

我找到的所有解决方案都不起作用。

这是从 cordova 自动创建的代码。

package com.example.hello;

import android.os.Bundle;
import org.apache.cordova.*;

public class HelloWorld 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");

    }
}

【问题讨论】:

  • 您是在使用phonegap(构建在云端)还是本地实现?
  • 本地实现

标签: android cordova ubuntu-14.04


【解决方案1】:

尝试: 尝试替换

index.html

为您的页面名称。

public class enlacedata 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());
        //Change your index.html for your page name
        super.loadUrl("file:///android_asset/www/index.html");
    }
}

【讨论】:

  • 是您在路径中引用的页面:assets/www/index.html?
  • 运行命令:phonegap build android &amp;&amp; phonegap run android
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-29
  • 2017-05-03
  • 2016-10-20
  • 2014-01-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多