Ionic Android应用程序可以工作,但安装时没有apk

时间:2016-09-05 00:42:02

标签: javascript android angularjs ionic-framework apk

我的应用在浏览器中使用ionic serve。它在使用USB调试在设备上模拟时有效,但在安装APK时失败。

启动屏幕出现,然后出现侧栏的静态(链接无法点击)版本。

这是我的index.html文件:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

     <!-- compiled css output -->
    <link href="css/ionic.app.css" rel="stylesheet">
     <link rel="stylesheet" href="css/style.css">
    
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="lib/ngCordova/dist/ng-cordova.js"></script>
    <script src="cordova.js"></script>

   

    
    

    <style type="text/css">
      .platform-ios .manual-ios-statusbar-padding{
        padding-top:20px;
      }
      .manual-remove-top-padding{
        padding-top:0px; 
      }
      .manual-remove-top-padding .scroll{
        padding-top:0px !important;
      }
      ion-list.manual-list-fullwidth div.list, .list.card.manual-card-fullwidth {
        margin-left:-10px;
        margin-right:-10px;
      }
      ion-list.manual-list-fullwidth div.list > .item, .list.card.manual-card-fullwidth > .item {
        border-radius:0px;
        border-left:0px;
        border-right: 0px;
      }
    </style>

    <!--link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="lib/ionic-material/dist/ionic.material.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <script src="lib/ionic/js/ionic.bundle.js"></script>
    <script src="lib/ionic-material/dist/ionic.material.min.js"></script-->

   



    <script src="js/app.js"></script>
    <script src="js/controllers.js"></script>
    <script src="js/routes.js"></script>
    <script src="js/services.js"></script>
    <script src="js/directives.js"></script>

    
    <script src="lib/ionicuirouter/ionicUIRouter.js"></script>

     <script src="lib/satellizer/dist/satellizer.min.js"></script>
    <script src="lib/satellizer/dist/satellizer.js"></script>
    <script src="lib/angular-permission/dist/angular-permission.js"></script>
    

    <!--chat feature-->
   
    <script src="lib/angular-elastic/elastic.js"></script>
    <!--link href="//code.ionicframework.com/1.0.0-beta.14/css/ionic.min.css" rel="stylesheet">
    <script src="//code.ionicframework.com/1.0.0-beta.14/js/ionic.bundle.min.js"></script--> 
    <!-- moment -->
    <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script>
    <!-- angular moment -->
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular-moment/0.8.2/angular-moment.min.js"></script>
     <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
      <!--script src="lib/Autolinker.js/dist/Autolinker.js"></script-->
        <script src="js/index.js"></script>

     <!--socket io client library-->
    <!--script src="http://chat.socket.io/socket.io/socket.io.js"></script-->

    <!-- Other Libraries-->
    <script src="lib/angular-sanitize/angular-sanitize.min.js"></script>
    <!--script src="lib/angular-socket-io/socket.js"></script-->


   

  </head>
  <body ng-app="app" animation="slide-left-right-ios7" ng-strict-di >
  <div>
    <ion-side-menus enable-menu-with-back-views="false" data-componentid="side-menu21" >
        <ion-side-menu-content>
            <ion-nav-bar class="bar-calm" >
                <ion-nav-back-button></ion-nav-back-button>
                <ion-nav-buttons side="left">
                    <button class="button button-icon button-clear ion-navicon" menu-toggle="left"></button>
                </ion-nav-buttons>
            </ion-nav-bar>
            <ion-nav-view></ion-nav-view>
        </ion-side-menu-content>
        <ion-side-menu side="left" id="side-menu21" style=''>
            <ion-header-bar class="bar-calm">
                <div class="title">Menu</div>
            </ion-header-bar>
            <ion-content padding="false" class="side-menu-left has-header">
                <ion-list id="menu-list3" class=" " data-componentid="list3">
                    <ion-item class="item-divider " id="menu-list-item-divider1" data-componentid="list-item-divider1">General</ion-item>
                </ion-list>
                <ion-list id="menu-list4" class=" " data-componentid="list4">
                    <ion-item id="menu-list-item10" ui-sref="home2.places" menu-close="" class="icon item item-icon-left" data-componentid="list-item10"><i class="icon ion-map"></i> Home</ion-item>
                    
                    <ion-item  class="icon item item-icon-left " id="menu-list-item23" menu-close="" ui-sref="home2.inbox" data-componentid="list-item23"><i class="icon ion-chatboxes"></i>Inbox</ion-item>
                    <ion-item  class="icon item item-icon-left" id="menu-list-item23" menu-close="" ui-sref="login" data-componentid="list-item23"> Login</ion-item>
                   
                </ion-list>
                <ion-list id="menu-list5" class=" " data-componentid="list5">
                    <ion-item class="item-divider " id="menu-list-item-divider4" data-componentid="list-item-divider4">App Info</ion-item>
            
                    <ion-item id="menu-list-item19" ui-sref="about" class="icon item item-icon-left" menu-close="" data-componentid="list-item19">About</ion-item>
                   
                    <ion-item id="menu-list-item21" ui-sref="policy" class="icon item item-icon-left" menu-close="" data-componentid="list-item21">Privacy Policy</ion-item>
                </ion-list>
            </ion-content>
        </ion-side-menu>
    </ion-side-menus>
</div>
  </body>
</html>

config.xml摘录

 <widget id="com.fdfdfdjhgvhy655565656ytyytytrtrt85656" version="1.1.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
  
  <content src="index.html"/>
  <access origin="*"/>
  <preference name="loadUrlTimeoutValue" value="70000"/>
  <preference name="webviewbounce" value="false"/>
  <preference name="UIWebViewBounce" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="SplashScreenDelay" value="9000"/>
  <preference name="FadeSplashScreenDuration" value="3000"/>
  <preference name="android-minSdkVersion" value="16"/>
  <preference name="BackupWebStorage" value="none"/>
  <preference name="SplashScreen" value="screen"/>
  <feature name="StatusBar">
    <param name="ios-package" value="CDVStatusBar" onload="true"/>
  </feature>
  <platform name="android">
    <icon src="resources\android\icon\drawable-ldpi-icon.png" density="ldpi"/>
    <icon src="resources\android\icon\drawable-mdpi-icon.png" density="mdpi"/>
    <icon src="resources\android\icon\drawable-hdpi-icon.png" density="hdpi"/>
    <icon src="resources\android\icon\drawable-xhdpi-icon.png" density="xhdpi"/>
    <icon src="resources\android\icon\drawable-xxhdpi-icon.png" density="xxhdpi"/>
    <icon src="resources\android\icon\drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
    <splash src="resources\android\splash\drawable-land-ldpi-screen.png" density="land-ldpi"/>
    <splash src="resources\android\splash\drawable-land-mdpi-screen.png" density="land-mdpi"/>
    <splash src="resources\android\splash\drawable-land-hdpi-screen.png" density="land-hdpi"/>
    <splash src="resources\android\splash\drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
    <splash src="resources\android\splash\drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
    <splash src="resources\android\splash\drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
    <splash src="resources\android\splash\drawable-port-ldpi-screen.png" density="port-ldpi"/>
    <splash src="resources\android\splash\drawable-port-mdpi-screen.png" density="port-mdpi"/>
    <splash src="resources\android\splash\drawable-port-hdpi-screen.png" density="port-hdpi"/>
    <splash src="resources\android\splash\drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
    <splash src="resources\android\splash\drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
    <splash src="resources\android\splash\drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
  </platform>
  <icon src="resources\android\icon\drawable-xhdpi-icon.png"/>
</widget>

不确定可能需要哪些其他信息。有人可以帮帮我吗?

尝试jsconsole.com并得到了这个:

file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17697link
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module angularMoment due to:
Error: [$injector:nomod] Module 'angularMoment' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.4.3/$injector/nomod?p0=angularMoment
    at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13380:12
    at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:15270:17
    at ensure (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:15194:38)
    at module (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:15268:14)
    at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17674:22
    at forEach (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13648:20)
    at loadModules (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17658:5)
    at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17675:40
    at forEach (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13648:20)
    at loadModules (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17658:5)
http://errors.angularjs.org/1.4.3/$injector/modulerr?p0=angularMoment&p1=Error%3A%20%5B%24injector%3Anomod%5D%20Module%20'angularMoment'%20is%20not%20available!%20You%20either%20misspelled%20the%20module%20name%20or%20forgot%20to%20load%20it.%20If%20registering%20a%20module%20ensure%20that%20you%20specify%20the%20dependencies%20as%20the%20second%20argument.%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.4.3%2F%24injector%2Fnomod%3Fp0%3DangularMoment%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13380%3A12%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15270%3A17%0A%20%20%20%20at%20ensure%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15194%3A38)%0A%20%20%20%20at%20module%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15268%3A14)%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17674%3A22%0A%20%20%20%20at%20forEach%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13648%3A20)%0A%20%20%20%20at%20loadModules%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17658%3A5)%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17675%3A40%0A%20%20%20%20at%20forEach%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13648%3A20)%0A%20%20%20%20at%20loadModules%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17658%3A5)
    at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13380:12
    at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17697:15
    at forEach (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13648:20)
    at loadModules (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17658:5)
    at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17675:40
    at forEach (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13648:20)
    at loadModules (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17658:5)
    at createInjector (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17584:11)
    at doBootstrap (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:14942:20)
    at bootstrap (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:14963:12)
http://errors.angularjs.org/1.4.3/$injector/modulerr?p0=app&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20Failed%20to%20instantiate%20module%20angularMoment%20due%20to%3A%0AError%3A%20%5B%24injector%3Anomod%5D%20Module%20'angularMoment'%20is%20not%20available!%20You%20either%20misspelled%20the%20module%20name%20or%20forgot%20to%20load%20it.%20If%20registering%20a%20module%20ensure%20that%20you%20specify%20the%20dependencies%20as%20the%20second%20argument.%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.4.3%2F%24injector%2Fnomod%3Fp0%3DangularMoment%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13380%3A12%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15270%3A17%0A%20%20%20%20at%20ensure%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15194%3A38)%0A%20%20%20%20at%20module%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15268%3A14)%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17674%3A22%0A%20%20%20%20at%20forEach%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13648%3A20)%0A%20%20%20%20at%20loadModules%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17658%3A5)%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17675%3A40%0A%20%20%20%20at%20forEach%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13648%3A20)%0A%20%20%20%20at%20loadModules%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17658%3A5)%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.4.3%2F%24injector%2Fmodulerr%3Fp0%3DangularMoment%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520Module%2520'angularMoment'%2520is%2520not%2520available!%2520You%2520either%2520misspelled%2520the%2520module%2520name%2520or%2520forgot%2520to%2520load%2520it.%2520If%2520registering%2520a%2520module%2520ensure%2520that%2520you%2520specify%2520the%2520dependencies%2520as%2520the%2520second%2520argument.%250Ahttp%253A%252F%252Ferrors.angularjs.org%252F1.4.3%252F%2524injector%252Fnomod%253Fp0%253DangularMoment%250A%2520%2520%2520%2520at%2520file%253A%252F%252F%252Fandroid_asset%252Fwww%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A13380%253A12%250A%2520%2520%2520%2520at%2520file%253A%252F%252F%252Fandroid_asset%252Fwww%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A15270%253A17%250A%2520%2520%2520%2520at%2520ensure%2520(file%253A%252F%252F%252Fandroid_asset%252Fwww%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A15194%253A38)%250A%2520%2520%2520%2520at%2520module%2520(file%253A%252F%252F%252Fandroid_asset%252Fwww%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A15268%253A14)%250A%2520%2520%2520%2520at%2520file%253A%252F%252F%252Fandroid_asset%252Fwww%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A17674%253A22%250A%2520%2520%2520%2520at%2520forEach%2520(file%253A%252F%252F%252Fandroid_asset%252Fwww%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A13648%253A20)%250A%2520%2520%2520%2520at%2520loadModules%2520(file%253A%252F%252F%252Fandroid_asset%252Fwww%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A17658%253A5)%250A%2520%2520%2520%2520at%2520file%253A%252F%252F%252Fandroid_asset%252Fwww%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A17675%253A40%250A%2520%2520%2520%2520at%2520forEach%2520(file%253A%252F%252F%252Fandroid_asset%252Fwww%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A13648%253A20)%250A%2520%2520%2520%2520at%2520loadModules%2520(file%253A%252F%252F%252Fandroid_asset%252Fwww%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A17658%253A5)%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13380%3A12%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17697%3A15%0A%20%20%20%20at%20forEach%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13648%3A20)%0A%20%20%20%20at%20loadModules%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17658%3A5)%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17675%3A40%0A%20%20%20%20at%20forEach%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13648%3A20)%0A%20%20%20%20at%20loadModules%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17658%3A5)%0A%20%20%20%20at%20createInjector%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17584%3A11)%0A%20%20%20%20at%20doBootstrap%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A14942%3A20)%0A%20%20%20%20at%20bootstrap%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A14963%3A12)
file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17697

1 个答案:

答案 0 :(得分:0)

我从未遇到过这个问题,但我认为这是因为导航器无法正确加载javascript文件(可能是未定义的调用),因此应用程序会在结束加载之前停止。

无论如何,要找出问题的最佳方法是即使在您的设备上也可以访问您的控制台。这有很多东西,但最好的可能是https://jsconsole.com/(它将您的设备日志重定向到远程控制台)