简体   繁体   English

Ionic Android应用程序正常运行,但安装后无法运行

[英]Ionic Android app works but not apk when installed

My app works in browser with ionic serve . 我的应用程序可在带有ionic serve浏览器中使用。 It works when emulated on device using USB debugging, however it fails when the APK is installed. 使用USB调试在设备上模拟时,它可以工作,但是在安装APK时,它会失败。

The splash screen comes up then a static (links cant be clicked) version of the side bar comes up. 启动画面出现,然后出现侧栏的静态(无法单击链接)版本。

Here is my index.html file: 这是我的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 snippet 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> 

Not sure what other info might be needed. 不知道可能需要其他信息。 Can anyone please help me? 谁能帮帮我吗?

Tried jsconsole.com and got this: 尝试了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 

I never faced this issue but I think it's because the navigator doesn't load properly javascript files (probably an undefined called) so the application stops while before ending the loading. 我从未遇到过这个问题,但是我认为这是因为导航器无法正确加载javascript文件(可能是未定义的调用),因此应用程序在结束加载之前就停止了。

Anyway, the best thing to do to find out the issue is to have access to your console even on your device. 无论如何,找出问题的最佳方法是即使在设备上也可以访问控制台。 There are many things for this but the best is probably https://jsconsole.com/ (it redirect your device logs into a remote console) 有很多事情要做,但是最好的办法可能是https://jsconsole.com/ (它将您的设备日志重定向到远程控制台)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Ionic和Cordova中构建Android APK - Building Android APK in Ionic and Cordova 在&#39;Ionic View&#39;中原生,但在.apk Android中不原生 - Native in 'Ionic View' but not native in the .apk Android 未安装应用程序时如何将用户重定向到(android,ios)市场 - how to redirect the user to the (android ,ios) market when the app doesnt installed Ionic应用程序可在浏览器上正常运行,但在我的Android设备上无法正常运行 - Ionic app works true on browser but does not work fine in my android device 链接点击在浏览器中工作,但不在android webview中 - IONIC - Link click works in browser, but not in android webview - IONIC GlUtilsParamSize使Ionic Android应用程序崩溃 - ionic android app crashes with glUtilsParamSize Codeceptjs仅在全局安装时有效 - Codeceptjs only works when installed globally APK 和 Expo Client android 应用程序不同 - APK and Expo Client android app are different 打包的混淆 javascript Android 应用程序在分发和安装时不起作用 - Packaged Obfuscated javascript Android app doesn't work when distributed and installed 当 Android 应用程序未安装而不是 Play 商店时重定向到自定义 web 页面 - Redirect to custom web page when Android App not installed instead of Play Store
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM