首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行cordova项目时,Android模拟器显示一个黑色页面。

运行cordova项目时,Android模拟器显示一个黑色页面。
EN

Stack Overflow用户
提问于 2014-10-26 05:23:55
回答 1查看 998关注 0票数 0

我正在Cordova上开发一个安卓应用程序。它只有一个index.html页面,包含1300行。

我已经成功地在模拟器上构建并运行了我最后一个简单的应用程序,但是当我试图运行这个特定的项目时,模拟器运行应用程序,但只显示一个黑色的页面。

我试过以下命令:

代码语言:javascript
复制
cordova run android

cordova emulate android

ionic run android

ionic emulate android

我在cmd上看到了这条线

代码语言:javascript
复制
debug:

BUILD SUCCESSFUL
Total time: 13 seconds
Built the following apk(s):
    C:\Users\Administrator\siminsarmayeh\platforms\android\ant-build\CordovaApp-
debug.apk
WARNING : No target specified, deploying to emulator 'emulator-5554'.
Installing app on emulator...
Using apk: C:\Users\Administrator\siminsarmayeh\platforms\android\ant-build\Cord
ovaApp-debug.apk
Launching application...
LAUNCH SUCCESS

但每次我都有同样的黑页。

我在模拟器上使用API-19 (Android 4.4.2)

是因为我在测试一个很大的项目吗?

编辑

这是我的索引Head tag

代码语言:javascript
复制
<head>

    <!-- ==============================================
        Title and basic Metas
        =============================================== -->
    <meta charset="UTF-8">
    <title>My App</title>

    <!-- ==============================================
        Mobile Metas
        =============================================== -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- ==============================================
        Favicons
        =============================================== -->

    <link rel="shortcut icon" href="images/icon/favicon.ico" type="image/x-icon">
    <link rel="apple-touch-icon-precomposed" href="images/icon/apple-touch-icon-57-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/icon/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/icon/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/icon/apple-touch-icon-144-precomposed.png">

    <link rel='stylesheet' id='bootstrap-css' href='css/bootstrap.min.css' type='text/css' media='all' />
    <link rel='stylesheet' id='font-awesome.min-css' href='css/font-awesome.min.css' type='text/css' media='all' />
    <link rel='stylesheet' id='style-css' href='style.css' type='text/css' media='all' />
    <script type='text/javascript' src='js/jquery.js?ver=1.10.2'></script>
    <script type='text/javascript' src='js/jquery-migrate.min.js?ver=1.2.1'></script>
    <script type='text/javascript' src='js/modernizr.custom.97074.js'></script>


    <script type='text/javascript' src='js/quickmetro_map.js'></script>
    <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://theme-art.com/quickmetro-wp/xmlrpc.php?rsd" />
    <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://theme-art.com/quickmetro-wp/wp-includes/wlwmanifest.xml" />
    <link rel='prev' title='Blog' href='http://theme-art.com/quickmetro-wp/blog/' />
    <link rel='next' title='Fullwidth Page' href='http://theme-art.com/quickmetro-wp/fullwidth-page/' />
    <meta name="generator" content="WordPress 3.7.1" />
    <link rel='canonical' href='http://theme-art.com/quickmetro-wp/' />
    <link rel='shortlink' href='http://theme-art.com/quickmetro-wp/?p=44' />
    <style type="text/css">
        .recentcomments a {
            display: inline !important;
            padding: 0 !important;
            margin: 0 !important;
        }
    </style>
    <style type="text/css">
        body {
            font-family: NASSIM,"Open Sans", Arial, Helvetica, sans-serif !important;
            font-size: 15px !important;
            background-color:#D0D8DD;
            background-repeat: no-repeat;
            background-attachment: fixed;
            background-position: center center;
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
        }

        h1, h2, h3, h4, h5, h6 {
            font-family: "Quicksand", Arial, Helvetica, sans-serif !important;
        }

        h1 {
            font-size: 50px !important;
        }

        h2 {
            font-size: 34px !important;
        }

        h3 {
            font-size: 26px !important;
        }

        h4 {
            font-size: 28px !important;
        }

        h5 {
            font-size: 38px !important;
        }

        h6 {
            font-size: 17px !important;
        }

        .navbar {
            font-family: "PT Sans", Arial, Helvetica, sans-serif !important;
        }

        .navbar-default .navbar-nav li a {
            font-size: 25px !important;
            font-family: NASSIM;
        }

        .home-link {
            width: 134px;
            height: 50px;
            padding: 0;
            background-image: url(images/icon/logo.png);
            background-repeat: no-repeat;
        }

        .section.home {
            background-image: url(uploads/2013/11/home-bg.jpg);
            background-repeat: no-repeat;
            background-attachment: fixed;
            background-position: center center;
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
        }

        .section.portfolio {
        }

        .section.about {
        }

        .section.service {
        }

        .section.team {
        }

        .section.client {
        }

        .section.contact {
        }

        .tile-portfolio {
            background: #00c6ff;
        }

        .tile-about {
            background: #f39c12;
        }

        .tile-service {
            background: #FD2561;
        }

        .tile-team {
            background: #FF08FF;
        }

        .tile-client {
            background: #49E035;
        }

        .tile-contact {
            background: #1B3146;
        }

        .modal-content {
            background: #005286;
        }

        .contact-box {
            background: #1A6593;
            background: rgba(26, 101, 147,0.9);
        }

        .tweet-box {
            background: #5398AF;
        }

        .skills {
            background: #146FA8;
            background: rgba(20,111,168,0.9);
        }

        .about-box {
            background: #146FA8;
            background:  rgba(20,111,168,0.9);
        }

        .check-our-work a {
            background: #4FBAFF;
            background: rgba(79,186,255,0.9);
        }

        .feature-box {
            background: #3196D6;
            background:rgba(49, 150, 214,0.9);
        }

        .team-member {
            background:#3196D6;
            background: rgba(49, 150, 214,0.9);
        }

        .navbar {
            background: #1A6593 !important;

        }

        ::-webkit-scrollbar {
            display: none;
        }

        .client .quotes {
            background: #2D92FF;
            background: rgba(45,146,255,0.8);
        }

            .client .quotes:after {
                border-left-color: #2D92FF;
                border-left-color: rgba(45,146,255,0.8);
            }

        .client .photos .author {
            background: #2D92FF;
            background: rgba(45,146,255,0.8);
        }

        @media (max-width:767px) {
            .client .quotes:after {
                border-left-color: transparent;
            }

            .client .quotes:before {
                border-bottom-color: #2D92FF;
                border-bottom-color: rgba(45,146,255,0.8);
            }
        }
        #qrpopup
        {
        position:fixed;z-index:9999;background-color:rgba(0, 0, 0,0.9);width:100%; height:100%;display:none;
        }
    </style>
</head>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-27 10:11:30

您还没有在您的cordova.js中包含index.html文件。将这一行添加到其中:

代码语言:javascript
复制
<script type='text/javascript' src='cordova.js'></script>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26570053

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档