【问题标题】:Ionic app not opening(Crashing) in android deviceIonic 应用程序未在 Android 设备中打开(崩溃)
【发布时间】:2019-07-17 12:14:25
【问题描述】:

我正在开发 Ionic 3 应用程序,该应用程序在所有设备上都可以运行 grt,但突然在我尝试打开时它会立即关闭。 应用程序在浏览器和构建路径中运行良好。 “平台\android\app\build\outputs\apk\debug\app-debug.apk” 我注意到为什么 apk 在调试文件夹中构建的一件事?

我尝试删除 node_module、平台。

这是我的离子信息:

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

全局包:

Cordova CLI : 8.0.0

本地包:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

系统:

Android SDK Tools : 26.1.1
Node              : v8.11.0
npm               : 5.6.0
OS                : Windows 7

插件列表:

call-number 0.0.2 "Cordova Call Number Plugin"
cordova-plugin-app-update 1.6.0 "AppUpdate"
cordova-plugin-appversion 1.0.0 "App Version"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-fcm-with-dependecy-updated 2.4.0 "Cordova FCM Push Plugin"
cordova-plugin-file 5.0.0 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-filepath 1.0.2 "FilePath"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-inappbrowser 3.1.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-nativegeocoder 3.2.2 "NativeGeocoder"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-x-socialsharing 5.4.7 "SocialSharing"
es6-promise-plugin 4.2.2 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"

config.xml

 <widget android-versionCode="" id="" version="1.2.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>****</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-navigation href="data:*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="ShowSplashScreen" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="auto-hide-splash-screen" value="false" />
<plugin name="cordova-plugin-ionic-webview" spec="^1.2.1" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<allow-navigation href="http://192.168.0.16:8100" />
<plugin name="cordova-plugin-filepath" spec="~1.0.2" />
<plugin name="cordova-plugin-file" spec="^5.0.0" />
<plugin name="cordova-plugin-file-transfer" spec="^1.7.1" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-x-socialsharing" spec="^5.4.1" />
<plugin name="cordova-plugin-app-update" spec="^1.6.0" />
<plugin name="cordova-plugin-splashscreen" spec="~5.0.2" />
<plugin name="cordova-plugin-nativegeocoder" spec="^3.2.2" />
<plugin name="cordova-plugin-geolocation" spec="^4.0.1">
    <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To locate you" />
</plugin>
<plugin name="cordova-plugin-camera" spec="~2.4.1" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreenDelay" value="3000" />
<plugin name="cordova-plugin-console" spec="^1.1.0" />
<engine androidspec="^6.3.0" name="" />
<plugin name="cordova-plugin-device" spec="^2.0.3" />
<plugin name="mx.ferreyra.callnumber" spec="~0.0.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.4" />
<plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
<platform name="android">
    <resource-file src="google-services.json" target="google-services.json" />
    <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
    <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
    <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
    <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
    <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
    <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
    <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
    <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
    <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
    <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
    <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
    <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
    <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
    <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
    <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
    <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
    <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
    <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<engine name="android" spec="7.0.0" />
<plugin name="cordova-plugin-fcm-with-dependecy-updated" spec="^2.4.0" />

为什么应用程序无法在 android 设备中正常打开,请指出可能出了什么问题?

【问题讨论】:

  • 关闭后是否显示错误信息?你用铬检查过吗?
  • 不,它不会显示错误,并且在我的系统中,离子运行无法正常工作
  • 在模拟器上运行应用程序并在 chrome 上检查并显示给她
  • 不,我在系统中没有模拟器,它有单独的问题要解决:-(.

标签: android ionic-framework ionic3 cordova-plugins


【解决方案1】:

1.删除android平台使用

ionic cordova platform remove android
  1. 手动删除 node-modulespackage-lock.json (imp*)

  2. 卸载旧应用程序

  3. npm cache clean --force

终于运行npm install

【讨论】:

    【解决方案2】:

    您是否尝试删除 android 平台并在之后添加它? 就这样:

    ionic cordova platform remove android
    ionic cordova platform add android
    

    我遇到了同样的问题,不知道为什么,但我这样做了,而且效果很好。

    【讨论】:

      【解决方案3】:

      在 Ionic 中生成发布 Apk:

      • 在平台/android 中使用下面的 sn-p 创建 release-signing.properties 文件

        key.store=xxx.keystore key.store.password=xxx key.alias=xxx key.alias.password=xxx

      • 将您的 Keystore 文件粘贴到 platform/android 目录中

      • 最后,运行ionic cordova build android --release生成release apk

      您能否在应用关闭时分享日志报告。您可以在 chrome://inspect 中查看调试应用程序的日志。

      【讨论】:

        【解决方案4】:

        在我的 ionic v3 应用程序中,当我遇到同样的问题时,问题出在 network_security_config.xml 文件中,我的应用程序也根本没有启动,我不得不删除一个域

        &lt;domain includeSubdomains="true"&gt;myurl.com&lt;/domain&gt;

        我不得不从提到的文件中删除此类域,希望它可以帮助某人

        【讨论】:

          【解决方案5】:

          如果您更改了 spalshscreen 或在 config.xml 中放置了错误的启动画面图像位置,则意味着应用程序将打开并检查启动画面图像,如果未获取意味着应用程序将被关闭。 因此,获得解决方案的更好方法是复制旧项目 config.xml 代码并将其放入新项目中,然后它将正常工作...... 那么如果你不打开也意味着。

          ionic cordova platform remove android    
          

          然后

          ionic cordova platform add android    
          

          会有用的

          【讨论】:

            【解决方案6】:

            这通常是来自您的应用的运行时错误。例如,尝试通过运行带有调试信息 (ionic serve) 的应用来获取有关该问题的更多信息。

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2011-04-08
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多