Android模拟器在运行cordova项目时显示黑页

时间:2014-10-26 05:23:56

标签: android cordova android-emulator

我正在Cordova开发一款Android应用。它只有一个index.html页面,其中包含1300行。

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

enter image description here

我尝试了这些命令:

cordova run android

cordova emulate android

ionic run android

ionic emulate android

我在cmd

上看到这一行
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

<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>

1 个答案:

答案 0 :(得分:1)

您的cordova.js中未包含index.html个文件。将此行添加到其中:

<script type='text/javascript' src='cordova.js'></script>