离子 6。当我添加 firebasex 插件时。 Ionic-native/http 停止工作
Ionic 6 . When I add firebasex plugin. Ionic-native/http stops working
我之前使用的是 FCM 插件。但它在 Android 11 上停止工作。所以想到切换到 firebasex 插件。但是一旦我将它添加到我的项目中。 ionic-native/http 停止工作。
离子信息:
Ionic:
Ionic CLI : 6.16.3
Ionic Framework : @ionic/angular 4.11.13
@angular-devkit/build-angular : 0.803.29
@angular-devkit/schematics : 8.3.29
@angular/cli : 8.3.29
@ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 10.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 25 other plugins)
Utility:
cordova-res : 0.15.3
native-run (update available: 1.4.1) : 1.2.2
System:
Android SDK Tools : 26.1.1
NodeJS : v12.19.0
npm : 6.14.9
OS : Linux 5.4
插件列表:
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-sqlite-storage": {},
"cordova-plugin-file": {},
"cordova-plugin-filechooser": {},
"cordova-plugin-filepath": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-network-information": {},
"cordova-plugin-googlemaps": {
"API_KEY_FOR_ANDROID": "AIzaSyCiIDP1JCs8RFSWAHwYZpFbhsbC9MyoUCI",
"API_KEY_FOR_IOS": "AIzaSyCiIDP1JCs8RFSWAHwYZpFbhsbC9MyoUCI",
"PLAY_SERVICES_VERSION": "15.0.1",
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-nativegeocoder": {},
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-unique-device-id2": {},
"cordova-plugin-advanced-http": {
"OKHTTP_VERSION": "3.10.0"
},
"com-badrit-base64": {},
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
"cordova-support-google-services": {},
"cordova-plugin-local-notification": {},
"cordova-plugin-dialogs": {},
"cordova-plugin-android-permissions": {},
"cordova-plugin-geolocation": {},
"cordova-plugin-app-version": {},
"cordova-plugin-enable-multidex": {},
"cordova-plugin-firebasex": {
"FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
"FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
"FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true",
"ANDROID_ICON_ACCENT": "#FF00FFFF",
"ANDROID_FIREBASE_PERFORMANCE_MONITORING": "false",
"ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION": "17.0.0",
"ANDROID_PLAY_SERVICES_AUTH_VERSION": "19.0.0",
"ANDROID_FIREBASE_ANALYTICS_VERSION": "19.0.0",
"ANDROID_FIREBASE_MESSAGING_VERSION": "22.0.0",
"ANDROID_FIREBASE_CONFIG_VERSION": "21.0.0",
"ANDROID_FIREBASE_PERF_VERSION": "20.0.2",
"ANDROID_FIREBASE_AUTH_VERSION": "21.0.1",
"ANDROID_FIREBASE_INAPPMESSAGING_VERSION": "20.0.0",
"ANDROID_FIREBASE_FIRESTORE_VERSION": "23.0.2",
"ANDROID_FIREBASE_FUNCTIONS_VERSION": "20.0.0",
"ANDROID_FIREBASE_IID_VERSION": "21.1.0",
"ANDROID_FIREBASE_INSTALLATIONS_VERSION": "17.0.0",
"ANDROID_FIREBASE_CRASHLYTICS_VERSION": "18.1.0",
"ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION": "18.1.0",
"ANDROID_GSON_VERSION": "2.8.7",
"ANDROID_FIREBASE_PERF_GRADLE_PLUGIN_VERSION": "1.4.0"
应用程序完美运行,直到我 运行 命令 npm install @ionic-native/firebase-x --save 。一旦发生 http 调用,代码的执行就会停止。除了抛出超时错误外,没有其他错误,我已经查看了服务器调用的日志并没有命中它。
由于 OKHTTP 版本的原因,Ionic Native 插件 Firebase X 与 Ionic Native HTTP 存在冲突问题。
这里有两种可能的解决方案。首先是通过将以下内容添加到 config.xml:
来锁定版本
<preference name="AndroidXEnabled" value="true" />
<preference name="OKHTTP_VERSION" value="3.12.1" />
或者您删除这两个插件并使用 OKHTTP 特定变量重新添加它:
ionic cordova plugin add cordova-plugin-firebasex --variable OKHTTP_VERSION=3.12
ionic cordova plugin add cordova-plugin-advanced-http --variable OKHTTP_VERSION=3.12
我之前使用的是 FCM 插件。但它在 Android 11 上停止工作。所以想到切换到 firebasex 插件。但是一旦我将它添加到我的项目中。 ionic-native/http 停止工作。
离子信息:
Ionic:
Ionic CLI : 6.16.3
Ionic Framework : @ionic/angular 4.11.13
@angular-devkit/build-angular : 0.803.29
@angular-devkit/schematics : 8.3.29
@angular/cli : 8.3.29
@ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 10.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 25 other plugins)
Utility:
cordova-res : 0.15.3
native-run (update available: 1.4.1) : 1.2.2
System:
Android SDK Tools : 26.1.1
NodeJS : v12.19.0
npm : 6.14.9
OS : Linux 5.4
插件列表:
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-sqlite-storage": {},
"cordova-plugin-file": {},
"cordova-plugin-filechooser": {},
"cordova-plugin-filepath": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-network-information": {},
"cordova-plugin-googlemaps": {
"API_KEY_FOR_ANDROID": "AIzaSyCiIDP1JCs8RFSWAHwYZpFbhsbC9MyoUCI",
"API_KEY_FOR_IOS": "AIzaSyCiIDP1JCs8RFSWAHwYZpFbhsbC9MyoUCI",
"PLAY_SERVICES_VERSION": "15.0.1",
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-nativegeocoder": {},
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-unique-device-id2": {},
"cordova-plugin-advanced-http": {
"OKHTTP_VERSION": "3.10.0"
},
"com-badrit-base64": {},
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
"cordova-support-google-services": {},
"cordova-plugin-local-notification": {},
"cordova-plugin-dialogs": {},
"cordova-plugin-android-permissions": {},
"cordova-plugin-geolocation": {},
"cordova-plugin-app-version": {},
"cordova-plugin-enable-multidex": {},
"cordova-plugin-firebasex": {
"FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
"FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
"FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true",
"ANDROID_ICON_ACCENT": "#FF00FFFF",
"ANDROID_FIREBASE_PERFORMANCE_MONITORING": "false",
"ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION": "17.0.0",
"ANDROID_PLAY_SERVICES_AUTH_VERSION": "19.0.0",
"ANDROID_FIREBASE_ANALYTICS_VERSION": "19.0.0",
"ANDROID_FIREBASE_MESSAGING_VERSION": "22.0.0",
"ANDROID_FIREBASE_CONFIG_VERSION": "21.0.0",
"ANDROID_FIREBASE_PERF_VERSION": "20.0.2",
"ANDROID_FIREBASE_AUTH_VERSION": "21.0.1",
"ANDROID_FIREBASE_INAPPMESSAGING_VERSION": "20.0.0",
"ANDROID_FIREBASE_FIRESTORE_VERSION": "23.0.2",
"ANDROID_FIREBASE_FUNCTIONS_VERSION": "20.0.0",
"ANDROID_FIREBASE_IID_VERSION": "21.1.0",
"ANDROID_FIREBASE_INSTALLATIONS_VERSION": "17.0.0",
"ANDROID_FIREBASE_CRASHLYTICS_VERSION": "18.1.0",
"ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION": "18.1.0",
"ANDROID_GSON_VERSION": "2.8.7",
"ANDROID_FIREBASE_PERF_GRADLE_PLUGIN_VERSION": "1.4.0"
应用程序完美运行,直到我 运行 命令 npm install @ionic-native/firebase-x --save 。一旦发生 http 调用,代码的执行就会停止。除了抛出超时错误外,没有其他错误,我已经查看了服务器调用的日志并没有命中它。
由于 OKHTTP 版本的原因,Ionic Native 插件 Firebase X 与 Ionic Native HTTP 存在冲突问题。
这里有两种可能的解决方案。首先是通过将以下内容添加到 config.xml:
来锁定版本<preference name="AndroidXEnabled" value="true" />
<preference name="OKHTTP_VERSION" value="3.12.1" />
或者您删除这两个插件并使用 OKHTTP 特定变量重新添加它:
ionic cordova plugin add cordova-plugin-firebasex --variable OKHTTP_VERSION=3.12
ionic cordova plugin add cordova-plugin-advanced-http --variable OKHTTP_VERSION=3.12