微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

IONIC 3 - 如何检查插件可能存在的问题?

如何解决IONIC 3 - 如何检查插件可能存在的问题?

我有一个 Ionic 3 应用程序,它在没有 --prod 标志(调试模式)的情况下编译时运行良好。当我设置 --prod 时,应用程序会在启动画面上停止。

这有效(应用程序打开正常):

离子科尔多瓦运行安卓

这也有效:

离子科尔多瓦构建安卓

这不起作用(应用程序在启动屏幕上停止):

ionic cordova build android --minifyjs --minifycss --release --aot

这个命令都不是:

ionic cordova build android --prod

这是我使用 adb logcat 时唯一的信息

$ adb logcat| grep CONSOLE
12-30 06:47:39.312 20569 20569 I chromium: [INFO:CONSOLE(4062)] "Angular is running in the development mode. Call enableProdMode() to enable the production mode.",source: file:///android_asset/www/build/vendor.js (4062)
12-30 06:47:39.968 20569 20569 I chromium: [INFO:CONSOLE(1233)] "deviceready has not fired after 5 seconds.",source: file:///android_asset/www/cordova.js (1233)
12-30 06:47:39.969 20569 20569 I chromium: [INFO:CONSOLE(1226)] "Channel not fired: onPluginsReady",source: file:///android_asset/www/cordova.js (1226)
12-30 06:47:39.969 20569 20569 I chromium: [INFO:CONSOLE(1226)] "Channel not fired: onCordovaReady",source: file:///android_asset/www/cordova.js (1226)
12-30 06:47:39.970 20569 20569 I chromium: [INFO:CONSOLE(186993)] "Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.",source: file:///android_asset/www/build/vendor.js (186993)
12-30 06:47:40.236 20569 20569 I chromium: [INFO:CONSOLE(3)] "Uncaught FirebaseError: Messaging: This browser doesn't support the API's required to use the firebase SDK. (messaging/unsupported-browser).",source: file:///android_asset/www/build/polyfills.js (3)
12-30 06:47:41.334 20569 20569 I chromium: [INFO:CONSOLE(186988)] "Ionic Native: deviceready event fired after 13596 ms",source: file:///android_asset/www/build/vendor.js (186988)

我尝试在生产模式下调试更改 build.grandle 文件,但没有成功:

    buildTypes {
        release {
            debuggable true
            minifyEnabled false
            signingConfig signingConfigs.release
        }
    }

这是我的离子信息:

$ ionic info

Ionic:

   Ionic CLI          : 6.12.3 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.3

Cordova:

   Cordova CLI       : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms : android 8.1.0
   Cordova Plugins   : cordova-plugin-ionic-webview 1.2.1,(and 26 other plugins)

Utility:

   cordova-res (update available: 0.15.2) : 0.8.1
   native-run                             : 1.3.0

System:

   Android SDK Tools : 26.1.1 (/home/diego/Android/Sdk)
   NodeJS            : v12.20.0 (/usr/local/bin/node)
   npm               : 6.14.10
   OS                : Linux 5.4

我的cordova插件列表输出

$ cordova plugin list
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-android-permissions 1.1.2 "Permissions"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-background-mode 0.7.3 "BackgroundMode"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-filechooser 1.2.0 "File Chooser"
cordova-plugin-firebase-lib 4.1.0 "Google Firebase Plugin"
cordova-plugin-geolocation 4.1.0 "Geolocation"
cordova-plugin-googlemaps 2.7.1 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 3.2.0 "InAppbrowser"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-nativeaudio 3.0.9 "Cordova Native Audio"
cordova-plugin-photo-library 2.2.1 "Photo Library"
cordova-plugin-request-location-accuracy 2.3.0 "Request Location Accuracy"
cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"
cordova-plugin-splashscreen 5.0.4 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-vibration 3.1.1 "Vibration"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-x-socialsharing 5.6.8 "SocialSharing"
cordova-plugin-youtube-video-player 1.0.6 "CordovaYoutubeVideoPlayer"
cordova-support-google-services 1.4.1 "cordova-support-google-services"
es6-promise-plugin 4.2.2 "Promise"
in.lucasdup.bringtofront 0.0.1 "Bring to Front"
uk.co.workingedge.phonegap.plugin.launchnavigator 5.0.5 "Launch Navigator"

感谢您的帮助。

谢谢。

解决方法

终于让它再次工作了!

对于任何在使用 ionic 3 + firebase 时遇到麻烦的人,这是我的工作设置:

package.json

"dependencies": {
    "@angular/animations": "5.2.11","@angular/common": "5.2.11","@angular/compiler": "5.2.11","@angular/compiler-cli": "5.2.11","@angular/core": "5.2.11","@angular/forms": "5.2.11","@angular/http": "5.2.11","@angular/platform-browser": "5.2.11","@angular/platform-browser-dynamic": "5.2.11","@firebase/app": "^0.6.2","cordova-plugin-androidx": "^1.0.2","cordova-plugin-androidx-adapter": "^1.1.0","cordova-plugin-firebase-analytics": "^4.0.0","cordova-plugin-firebase-lib": "^4.1.0","firebase": "7.14.2","firebase-config": "0.0.2","firebase-functions": "^3.2.0","firebase-tools": "^6.1.1","ionic-angular": "3.9.2","rxjs": "^6.3.3","rxjs-compat": "^6.3.3",},"devDependencies": {
   "@ionic/app-scripts": "3.2.3","cordova-plugin-ionic-webview": "^4.0.0","typescript": "2.6.2"
},

离子信息

ionic info

Ionic:

   Ionic CLI          : 5.4.16 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.3

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : android 7.1.4
   Cordova Plugins   : cordova-plugin-ionic-webview 1.2.1,(and 27 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 1.3.0

System:

   Android SDK Tools : 26.1.1 (/home/diego/Android/Sdk)
   NodeJS            : v10.16.0 (/usr/local/bin/node)
   npm               : 6.14.10
   OS                : Linux 5.4

谢谢!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。