离子应用程序无法在Android设备中打开(崩溃)

时间:2019-07-17 12:14:25

标签: android ionic-framework ionic3 cordova-plugins

我正在使用Ionic 3应用程序,该应用程序在所有设备上均正常工作,但是突然,当我尝试打开时它将立即关闭。 应用在浏览器和构建路径中的表现都很好。 “平台\ 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设备中正常打开,请提示可能出了什么问题?

5 个答案:

答案 0 :(得分:0)

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

ionic cordova platform remove android
ionic cordova platform add android

我遇到了同样的问题,不知道为什么,但是我做到了,而且还在工作。

答案 1 :(得分:0)

1。使用删除Android平台

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

  2. Unistall 旧应用

  3. npm cache clean --force

最终运行npm install

答案 2 :(得分:0)

要在Ionic中生成发布Apk:

  • 使用platform / android中的以下代码片段创建release-signing.properties文件

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

  • 将密钥库文件粘贴到platform / android目录

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

您可以在应用关闭时共享日志报告吗?您可以在chrome:// inspect中看到调试应用程序的日志。

答案 3 :(得分:0)

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

<domain includeSubdomains="true">myurl.com</domain>

我不得不从提到的文件中删除该域,希望它对某人有所帮助

答案 4 :(得分:0)

如果您更改了spalshscreen或在 config.xml 装置中将初始屏幕图像放置在错误的位置,则该应用将打开并检查初始屏幕图像(如果未获取)表示该应用将被关闭。 因此,获得解决方案的更好方法是将旧项目config.xml代码复制到新项目中,然后它将正常工作... 然后,如果您未打开意味着。

ionic cordova platform remove android    

然后

ionic cordova platform add android    

它将起作用