android - Ionic 应用程序未在 Android 设备中打开(崩溃)
问题描述
我正在开发 Ionic 3 应用程序,该应用程序在所有设备上都可以使用 grt,但是当我尝试打开时它会立即关闭。应用程序在浏览器和构建路径中运行良好。“platforms\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"
配置文件
<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 设备中正确打开,请提出可能出现的问题?
解决方案
1.删除android平台使用
ionic cordova platform remove android
手动删除
node-modules
和package-lock.json
(imp*)卸载旧应用程序
npm cache clean --force
终于跑了npm install
推荐阅读
- javascript - 带有脚本的区块链的前端虚拟机和代码编辑器究竟是如何工作的?
- css - 您尝试使用标准 CSS 解析器解析 SCSS;使用 postcss-scss 解析器重试
- javascript - Firebase Firestore / React Native 聊天通知
- python - 从字典列表中删除键
- php - 有一个带有“加入”和“位置”的 Laravel 查询,以便获得基于过敏原限制的配方?
- python - 为什么在 Jupyter 中以逗号和空格开头的行会生成一个字符串元组?
- java - 在java中并行化for循环
- javascript - 带有 $group 的 Angular controller.js 聚合方法
- javascript - React - sinon 测试 - 获取 TypeError:无法读取未定义的属性“子字符串”
- docker - Kafka Streams 无法连接到无 Zookeeper 代理