Phonegap应用程序无法启动

时间:2014-11-07 07:54:17

标签: android cordova

我是手机缺口的新手,我很困惑为什么我的应用程序无法启动。

我的html和log cat代码如下所示。

当我运行应用程序时,它会显示一个空白页面。

INdex.html: -

<!DOCTYPE html>
<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 href="css/HDFCERGO_CSM.min.css" rel="stylesheet" />
                 <link href="css/jquery.mobile.icons.min.css" rel="stylesheet" />-->
                <link href="css/Custom-HDFC.css" rel="stylesheet" />
                <link href="css/jquery.mobile.custom-icons.min.css" rel="stylesheet" />
                <link href="css/jqm-icon-pack-fa.css" rel="stylesheet" />


    <!-- jQuery and jQuery Mobile -->

                <link href="css/jquery.mobile.structure-1.4.2.min.css" rel="stylesheet" />
                <link href="css/style.css" rel="stylesheet" />


                <link href="css/jquery.mobile.iscrollview.css" rel="stylesheet" />
                <link href="css/jquery.mobile.iscrollview-pull.css" rel="stylesheet" />
                <script src="scripts/lib/jquery-1.10.2.min.js"></script>
                <script src="scripts/lib/jquery.mobile-1.4.2.min.js"></script>

                <script src="scripts/lib/jquery.mobile-1.10.2.min.js"></script>

    <script src="scripts/lib/iscroll.js"></script>

    <script src="scripts/lib/underscore.js"></script>
    <script src="scripts/lib/backbone.js"></script>
    <script src="scripts/lib/backbone-validation-min.js"></script>
    <script src="scripts/lib/jquery.md5.js"></script>
    <script src="scripts/lib/jquery.blockUI.js"></script>
    <script src="scripts/lib/jquery.mobile.iscrollview.js"></script>

<script type="text/javascript" src="cordova.js"></script>
<script src="scripts/lib/backbone.validation.js"></script>

    <script src="scripts/utility/MessageUtils.js"></script>

    <!-- Utility
     <script src="scripts/utility/AJAX.js"></script>
     <script src="scripts/utility/ajax-config.js"></script>
     -->
    <script src="scripts/templates.js"></script>
    <script src="scripts/utility/router.js"></script>
    <script src="scripts/utility/common.js"></script>
    <script src="scripts/utility/utils.js"></script>
    <script src="scripts/utility/oauth.js"></script>
    <script src="scripts/utility/OAuthUtils.js"></script>


    <script src="scripts/application.js"></script>

    <!-- Model JS -->
    <script src="scripts/models/AuthenticationModel.js"></script>
    <script src="scripts/models/UserModel.js"></script>
    <script src="scripts/models/CashTransactionModel.js"></script>
    <script src="scripts/models/BasiscontractModel.js"></script>
    <script src="scripts/models/FuturescontractModel.js"></script>
    <script src="scripts/models/HTAcontractModel.js"></script>
    <script src="scripts/models/IndemnitypaymentModel.js"></script>
    <script src="scripts/models/OptionscontractModel.js"></script>
    <script src="scripts/models/OtherRevenueModel.js"></script>
    <script src="scripts/models/PercentagecontractModel.js"></script>
    <script src="scripts/models/CommonFetchServiceModel.js"></script>
    <script src="scripts/models/AccountSummaryModel.js"></script>



    <!-- Views JS -->
    <script src="scripts/views/LoginView.js"></script>
    <script src="scripts/views/HomeView.js"></script>
    <script src="scripts/views/CashTransactionView.js"></script>
    <script src="scripts/views/BasiscontractView.js"></script>
    <script src="scripts/views/FuturescontractView.js"></script>
    <script src="scripts/views/HTAcontractView.js"></script>
    <script src="scripts/views/IndemnitypaymentView.js"></script>
    <script src="scripts/views/OptionscontractView.js"></script>
    <script src="scripts/views/OtherRevenueView.js"></script>
    <script src="scripts/views/PercentagecontractView.js"></script>
    <script src="scripts/views/LeftsideMenu.js"></script>


    <!-- nativeDroid: Color Schemes --
    <link rel="stylesheet" href="css/jquerymobile.nativedroid.color.yellow.css" id='jQMnDColor' />
    <!-- nativeDroid core CSS --
    <link rel="stylesheet" href="css/jquerymobile.nativedroid.css" />
    lem. I have user entered data that my app save daily in sqlite and updates the values. I have developed a Custom
    <!-- nativeDroid: Light/Dark --
    <link rel="stylesheet" href="css/jquerymobile.nativedroid.dark.css"  id='jQMnDTheme' />

     -->



    <title>HDFC ERGO LOGIN PAGE</title>
    <script type="text/javascript" charset="utf-8">

//        function isOnline(){
//            
//            
////            var _check=true;
////            var networkState = navigator.network.connection.type;
////            var states = {};
////            states[Connection.UNKNOWN]  = 'Unknown connection';
////            states[Connection.ETHERNET] = 'Ethernet connection';
////            states[Connection.WIFI]     = 'WiFi connection';
////            states[Connection.CELL_2G]  = 'Cell 2G connection';
////            states[Connection.CELL_3G]  = 'Cell 3G connection';
////            states[Connection.CELL_4G]  = 'Cell 4G connection';
////            states[Connection.NONE]     = 'No network connection';
////            
////            if(networkState==="unknown" || networkState==="none")
////            {
////                
////                _check=false;
////                // showAlert();
////                return _check;
////            }
////            else
////            {
////                
////                return true;
////            }
//
//}
            // return (navigator.network.connection.type !== 'none' && navigator.network.connection.type !== 'unknown') ? true : false;
       // }

        function isTextInput(node) {
            return ['INPUT', 'TEXTAREA'].indexOf(node.nodeName) !== -1;
        }

    document.addEventListener('touchend', function(e) {
          if (!isTextInput(e.target) && isTextInput(document.activeElement)) {
              document.activeElement.blur();

              var inputs = document.querySelectorAll('input');
              for(var i=0; i < inputs.length; i++) {
              inputs[i].blur();
              }

          }

        }, false);

        $.support.cors = true;
        $.event.special.tap.emitTapOnTaphold = false;

        var myScroll;

        function imageUpload() {
            $('#firstImage').attr("src", "images/hdfc.png");
        }

        $(document).on('pageshow', function () {
            $('#inputPasscode').val("");
        });

        $(document).on('click', '#btnSyncClaimDetail', function () {
            syncClaimDetails();
        });

        $(document).on('click', '#btnPasscode', function () {
                      // showLoading();
        jQuery.mobile.changePage(jQuery('#homepage'), { transition: "flip" });


            //validatePassCode();
                       //alert("rohit");

//                       appAvailability.check(
//                                             'fb://', // URI Scheme
//                                             function() {  // Success callback
//                                             alert("rohit1");
//                                             },
//                                             function() {  // Error callback
//                                             alert("rohit2");
//                                             }
//                                             );
//                       
//                       appAvailability.checkBool('fb://', function(availability) {
//                                                 // availability is either true or false
//                                                 if(availability) { alert("rohit1");}
//                                                 });

        });
        /* Calendar Event Clear Function */
        $(document).on('click', '#event-clear', function (event) {
            event.preventDefault();
            clearCalendarEvent();
        });

        /* Calendar Event Save Function */
        $(document).on('click', '#event-save', function (event) {
            event.preventDefault();
            saveEventToCalendar(event);
        });

        $(document).on('keypress', '#inputPasscode', function () {
            var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
            if (keyCode == 13) {
                validatePassCode();
            }
        });


        $(document).delegate("#viewHistoryImages", "pageinit", function () {
            $('.swipebox').swipebox({
                useCSS: true,
                useSVG: false,
                hideBarsOnMobile: false,
                hideBarsDelay: 3000,
                videoMaxWidth: 1140
            });
        });

        $(document).delegate("#viewBreakInImages", "pageinit", function () {
            $('.swipebox').swipebox({
                useCSS: true,
                useSVG: false,
                hideBarsOnMobile: false,
                hideBarsDelay: 3000,
                videoMaxWidth: 1140
            });
        });

        function openClaimScreenlist() {
            jQuery.mobile.changePage(jQuery('#claim-screen-list'), { transition: "none" });
        }
        $(document).on('click', '#btn-save-claimNo', function () {
            alert('save');
            openClaimScreenlist();

        });
        $(document).on('pageinit', '#newCalendar', function () {
            $("#container .iscroll-content").html("");
            var pageName = 'calendar';
            $.get("./pages/" + pageName + ".html", function (html) {
                $("#container .iscroll-content").html(html);
                setTimeout(function () {
                    $.mobile.activePage.trigger("create");
                    $("#container").iscrollview("refresh");
                    setCalendarHTML();
                }, 500);
            });

        });

        $(document).on('pageshow', '#dashboardpage', function () {
            /*changes for Panel Dashboard*/
            $('.ui-panel').css({ 'top': 59 });
        });
        $(function () {
            $("#ss").click(function () {
                $("#st-container").addClass("st-effect-11");
                $("#st-container").addClass("st-menu-open");
                $("#ss").hide();
                $("#closeb").show();
            });

        });

        // Open DropDown

        $(document).on('click', '#dd', function (event) {

                       $('.ClickList').css("background","white");

                       $(this).toggleClass('active');

                       event.stopPropagation();
        });



        // Close DropDown

       $(document).on('click', '.ClickList', function (event) {


                    //  jQuery.mobile.changePage(jQuery('#CashTransactionScreen'), { transition: "slide" });
                      $(this).css("background","rgb(234, 201, 44)");
                      $('.wrapper-dropdown-5').removeClass('active');

                      $(this).toggleClass('active');

                      event.stopPropagation();


        });

        // Chnage Password

        $(document).on('click', '#ChangePasscode', function (event) {

                       // Close DropDown

                       jQuery('#OptionRightMenu').panel().panel('close');

        });

        // SignOut

        $(document).on('click', '#signout', function (event) {

                       // Close DropDown

                       jQuery('#OptionRightMenu').panel().panel('close');

                       jQuery.mobile.changePage(jQuery('#passcode'), { transition: "flip" });


        });

        // Back_CashForm

        $(document).on('click', '#Back_CashForm', function (event) {

                       // Close DropDown

                       jQuery('#CashTransactionScreen').panel().panel('close');


                       });

        // CashTransactionScreen1

       $(document).on('click', '#CashTransactionScreen1', function (event) {

                      // Close DropDown

                      jQuery('#CashTransactionScreen').panel().panel('open');


                      });


        // Back_CashForm

        $(document).on('click', '#Back_HTAForm', function (event) {

                       // Close DropDown

                       jQuery('#HTAcontractScreen').panel().panel('close');


                       });

                       // HTAcontractScreen1

                       $(document).on('click', '#HTAcontractScreen1', function (event) {

                                      // Close DropDown

                                      jQuery('#HTAcontractScreen').panel().panel('open');


                                      });



        // Back_CashForm

        $(document).on('click', '#Back_BasisForm', function (event) {

                       // Close DropDown

                       jQuery('#BasiscontractScreen').panel().panel('close');


                       });

                       // Basis contract

                       $(document).on('click', '#BasiscontractScreen1', function (event) {

                                      // Close DropDown

                                      jQuery('#BasiscontractScreen').panel().panel('open');


                                      });


        // Back_CashForm

        $(document).on('click', '#Back_PercentageForm', function (event) {

                       // Close DropDown

                       jQuery('#PercentagecontractScreen').panel().panel('close');


                       });

                       // Percentage contract

                       $(document).on('click', '#PercentagecontractScreen1', function (event) {

                                      // Close DropDown

                                      jQuery('#PercentagecontractScreen').panel().panel('open');


                                      });


        // Back_CashForm

        $(document).on('click', '#Back_FuturesForm', function (event) {

                       // Close DropDown

                       jQuery('#FuturescontractScreen').panel().panel('close');


                       });

                       // Futures contract

                       $(document).on('click', '#FuturescontractScreen1', function (event) {

                                      // Close DropDown

                                      jQuery('#FuturescontractScreen').panel().panel('open');


                                      });


        // Back_CashForm

        $(document).on('click', '#Back_OptionsForm', function (event) {

                       // Close DropDown

                       jQuery('#OptionscontractScreen').panel().panel('close');


                       });

                       // Options contract

                       $(document).on('click', '#OptionscontractScreen1', function (event) {

                                      // Close DropDown

                                      jQuery('#OptionscontractScreen').panel().panel('open');


                                      });


        // Back_CashForm

        $(document).on('click', '#Back_IndemnityForm', function (event) {

                       // Close DropDown

                       jQuery('#IndemnitypaymentScreen').panel().panel('close');


                       });

                       // Indemnity payment

                       $(document).on('click', '#IndemnitypaymentScreen1', function (event) {

                                      // Close DropDown

                                      jQuery('#IndemnitypaymentScreen').panel().panel('open');


                                      });

        // Back_CashForm

        $(document).on('click', '#Back_OtherForm', function (event) {

                       // Close DropDown

                       jQuery('#OtherRevenueScreen').panel().panel('close');


                       });

                       // Options contract

                       $(document).on('click', '#OtherRevenueScreen1', function (event) {

                                      // Close DropDown

                                      jQuery('#OtherRevenueScreen').panel().panel('open');


                                      });



// Menu List click

$(document).on('click', '.ClickMenuList', function (event) {

    $('.ClickMenuList').css("color","white");
    $('.ClickMenuList').css("background","Transparent");


    $(this).css("color","black");
    $(this).css("background","rgb(234, 201, 44)");


});

// Menu1 List click

$(document).on('click', '.ClickMenuList1', function (event) {


    $('.ClickMenuList1').css("color","white");
    $('.ClickMenuList1').css("background","Transparent");


    $(this).css("color","black");
    $(this).css("background","rgb(234, 201, 44)");


});

// Menu2 List click

$(document).on('click', '.ClickMenuList2', function (event) {


    $('.ClickMenuList2').css("color","white");
    $('.ClickMenuList2').css("background","Transparent");


    $(this).css("color","black");
    $(this).css("background","rgb(234, 201, 44)");


});

// Menu3 List click

$(document).on('click', '.ClickMenuList3', function (event) {


    $('.ClickMenuList3').css("color","white");
    $('.ClickMenuList3').css("background","Transparent");


    $(this).css("color","black");
    $(this).css("background","rgb(234, 201, 44)");


});

// Menu4 List click

$(document).on('click', '.ClickMenuList4', function (event) {


    $('.ClickMenuList4').css("color","white");
    $('.ClickMenuList4').css("background","Transparent");


    $(this).css("color","black");
    $(this).css("background","rgb(234, 201, 44)");


});



// Menu5 List click

$(document).on('click', '.ClickMenuList5', function (event) {

    $('.ClickMenuList5').css("color","white");
    $('.ClickMenuList5').css("background","Transparent");


    $(this).css("color","black");
    $(this).css("background","rgb(234, 201, 44)");


});

// Menu6 List click

$(document).on('click', '.ClickMenuList6', function (event) {


    $('.ClickMenuList6').css("color","white");
    $('.ClickMenuList6').css("background","Transparent");


    $(this).css("color","black");
    $(this).css("background","rgb(234, 201, 44)");


});

// Menu7 List click

$(document).on('click', '.ClickMenuList7', function (event) {


    $('.ClickMenuList7').css("color","white");
    $('.ClickMenuList7').css("background","Transparent");


    $(this).css("color","black");
    $(this).css("background","rgb(234, 201, 44)");


});





    </script>

</head>
<body>
   <!-- LoginScreen Start data-iscroll --------------------------------------------------------------------------------------------------------------------------------------------->


   <!-- LoginScreen End  --------------------------------------------------------------------------------------------------------------------------------------------->


    <!-- HomeScreen Start  --------------------------------------------------------------------------------------------------------------------------------------------->



<!-- HomeScreen End  --------------------------------------------------------------------------------------------------------------------------------------------->




  </body>
</html>

Log Cat是: -

11-07 02:39:12.393: E/Cordova(1991): Error loading url gap://ready
11-07 02:39:12.393: E/Cordova(1991): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=gap://ready }
11-07 02:39:12.393: E/Cordova(1991):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
11-07 02:39:12.393: E/Cordova(1991):    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
11-07 02:39:12.393: E/Cordova(1991):    at android.app.Activity.startActivityForResult(Activity.java:3424)
11-07 02:39:12.393: E/Cordova(1991):    at android.app.Activity.startActivityForResult(Activity.java:3385)
11-07 02:39:12.393: E/Cordova(1991):    at org.apache.cordova.DroidGap.startActivityForResult(DroidGap.java:1107)
11-07 02:39:12.393: E/Cordova(1991):    at android.app.Activity.startActivity(Activity.java:3627)
11-07 02:39:12.393: E/Cordova(1991):    at android.app.Activity.startActivity(Activity.java:3595)
11-07 02:39:12.393: E/Cordova(1991):    at org.apache.cordova.CordovaWebViewClient.shouldOverrideUrlLoading(CordovaWebViewClient.java:149)
11-07 02:39:12.393: E/Cordova(1991):    at com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:293)
11-07 02:39:12.393: E/Cordova(1991):    at com.android.org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:96)
11-07 02:39:12.393: E/Cordova(1991):    at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
11-07 02:39:12.393: E/Cordova(1991):    at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
11-07 02:39:12.393: E/Cordova(1991):    at android.os.Handler.dispatchMessage(Handler.java:102)
11-07 02:39:12.393: E/Cordova(1991):    at android.os.Looper.loop(Looper.java:136)
11-07 02:39:12.393: E/Cordova(1991):    at android.app.ActivityThread.main(ActivityThread.java:5017)
11-07 02:39:12.393: E/Cordova(1991):    at java.lang.reflect.Method.invokeNative(Native Method)
11-07 02:39:12.393: E/Cordova(1991):    at java.lang.reflect.Method.invoke(Method.java:515)
11-07 02:39:12.393: E/Cordova(1991):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-07 02:39:12.393: E/Cordova(1991):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-07 02:39:12.393: E/Cordova(1991):    at dalvik.system.NativeStart.main(Native Method)

显示代码和数据。如果有人有想法,请告诉我。提前谢谢。

1 个答案:

答案 0 :(得分:1)

看起来这是AndroidManifest的问题(“找不到活动...”)。请务必遵循文档(http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-Line%20Interface)并从头开始。

$> cordova create hello com.example.hello HelloWorld $> cordova platform add android

将您的文件复制到www文件夹中(将index.html替换为您的文件内容) 然后尝试运行

$&GT; cordova run`