当我在Android平台上启动我的Ionic App时,它会向我显示错误有时候
应用程序错误 - 与服务器的连接失败。 (文件:///android_asset/www/index.html)
然后App尝试崩溃5到6次然后App加载。如何解决此错误 有些人建议我没有任何外部JavaScript链接都在项目中下载。 我的索引文件
的index.html
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- Web client for push Notification-->
<script src="lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js"></script>
<script src="js/externalLibrary/jquery.min.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="js/externalLibrary/ng-cordova.js"></script>
<!-- <script src="lib/logtofile/www/logtofile.js"></script> -->
<!-- your app's js -->
<script src="js/externalLibrary/mqttws31.js"></script>
<script src="js/app.js"></script>
<script src="js/externalLibrary/ion-pullup.js"></script>
<script src="app/services/menuContent.js"></script>
<!-- Cordova is bootstrapped by ionic-platform-web-client, uncomment this if you remove ionic-platform-web-client... -->
<!-- <script src="cordova.js"></script> -->
<script src="js/controllers.js"></script>
<script src="app/constant/constant.js"></script>
<script src="app/constant/string.js"></script>
<script src="app/services/TrackingApi.js"></script>
<script src="app/services/errorHandling.js"></script>
<script src="app/services/shareData.js"></script>
<script src="app/geofencetoolkit/geofenceCtrl.js"></script>
<script src="app/geofencetoolkit/geofenceeditCtrl.js"></script>
<script src="app/vtracking/VTrackingCtrl.js"></script>
<script src="app/vtracking/trackingCtrl.js"></script>
<script src="app/services/DataPassService.js"></script>
<script src="app/walktocar/walktocarCtrl.js"></script>
<script src="app/adddevice/deviceCtrl.js"></script>
<script src="app/settings/settingsCtrl.js"></script>
<script src="app/loginPage/loginPageCtrl.js"></script>
<script src="app/addAccount/jioLoginCtrl.js"></script>
<script src="app/addAssignee/addAssigneeCtrl.js"></script>
<script src="app/carList/carListingCtrl.js"></script>
<script src="app/homePage/homePageCtrl.js"></script>
<script src="app/dashboard/dashboardCtrl.js"></script>
<script src="app/patrolLevel/patrolLevelCtrl.js"></script>
<script src="app/coolantTemp/coolantTempCtrl.js"></script>
的Config.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.harman.jiocarconnected" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Jio Car Connect</name>
<description>

An Ionic Framework and Cordova project.

</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">

Ionic Framework Team

</author>
<content src="index.html"/>
<access origin="*" subdomains="true"/>
<access origin="tel:*" launch-external="yes"/>
<access origin="cdvfile://*"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="android-minSdkVersion" value="16"/>
<preference name="loadUrlTimeoutValue" value="17000" />
<preference name="FadeSplashScreen" value="false"/>
<preference name="AndroidPersistentFileLocation" value="Compatibility"/>
<preference name="BackupWebStorage" value="none"/>
<preference name="SplashScreen" value="screen"/>
<preference name="android-windowSoftInputMode" value="adjustPan"/>
<!-- <preference name="SplashScreenDelay" value="5000"/> -->
<preference name="AutoHideSplashScreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="true"/>
<preference name="StatusBarOverlaysWebView" value="false"/>
<preference name="StatusBarBackgroundColor" value="#009c84"/>
<preference name="StatusBarStyle" value="lightcontent"/>
<preference name="Orientation" value="portrait"/>
<preference name="android-targetSdkVersion" value="20"/>
<hook type="before_run" src="hooks/appBeforeBuild.js" />
<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-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>
答案 0 :(得分:0)
应该在应用程序中调用所有Javascript,Css文件,不应该从Web调用,这个bug有三个原因
如果您想在设备上调用make 互联网正常,则不应从网络上调用Javascript或Css文件,
可能缺少一些重要的JS文件
在index.html内调用的文件可能会崩溃或丢失
答案 1 :(得分:0)
有两件事
当您的index.html必须从Web服务器加载js或css且它没有连接时(例如指向http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js的脚本标记
你的js脚本的顺序,你可以首先使用cord,jquery然后离子。这是为了正确加载依赖项
答案 2 :(得分:0)
将此行添加到config.xml
<preference name="loadUrlTimeoutValue" value="700000"/>