在构建android时,我一直收到此错误:第一个问题是由firebase插件引起的,然后我找到了解决方案(cordova-android-firebase-gradle-release)。尝试了15。+ ...不起作用:/
-错误:https://i.imgur.com/s3mVcXY.png(离子Cordova构建Android) -package.json:https://i.imgur.com/UsfuF2f.png
$ cordova -v 8.1.2(cordova-lib@8.1.1)
$ ionic -v 3.20.1
完整的package.json:
{
"name": "Test",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"start": "ionic-app-scripts serve",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint"
},
"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",
"@ionic-native/app-availability": "^5.6.0",
"@ionic-native/call-number": "^4.20.0",
"@ionic-native/core": "~4.18.0",
"@ionic-native/file": "^5.6.0",
"@ionic-native/firebase": "^4.18.0",
"@ionic-native/geolocation": "^5.6.0",
"@ionic-native/in-app-browser": "^5.6.0",
"@ionic-native/keyboard": "^4.20.0",
"@ionic-native/launch-navigator": "~4.18.0",
"@ionic-native/media": "^4.20.0",
"@ionic-native/network": "^4.20.0",
"@ionic-native/social-sharing": "^4.20.0",
"@ionic-native/splash-screen": "~4.18.0",
"@ionic-native/sqlite": "^4.20.0",
"@ionic-native/sqlite-porter": "^4.20.0",
"@ionic-native/status-bar": "~4.18.0",
"@ionic/pro": "2.0.4",
"@ionic/storage": "^2.2.0",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"angularfire2": "^5.1.3",
"call-number": "1.0.1",
"cordova-android": "7.1.4",
"cordova-android-firebase-gradle-release": "^3.0.0",
"cordova-android-play-services-gradle-release": "^3.0.0",
"cordova-plugin-actionsheet": "^2.3.3",
"cordova-plugin-appavailability": "^0.4.2",
"cordova-plugin-cocoapod-support": "^1.6.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "2.0.1",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-firebase": "2.0.5",
"cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^3.1.2",
"cordova-plugin-media": "^5.0.2",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-x-socialsharing": "^5.4.4",
"cordova-sqlite-storage": "^3.2.0",
"es6-promise-plugin": "^4.2.2",
"ionic-angular": "3.9.3",
"ionicons": "3.0.0",
"leaflet": "^1.5.1",
"mx.ferreyra.callnumber": "0.0.2",
"promise-polyfill": "^8.1.0",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.5.2",
"sw-toolbox": "3.6.0",
"uk.co.workingedge.cordova.plugin.sqliteporter": "^1.1.0",
"uk.co.workingedge.phonegap.plugin.launchnavigator": "^3.2.2",
"zone.js": "0.8.29"
},
"devDependencies": {
"@ionic/app-scripts": "3.2.1",
"typescript": "~2.8"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-appavailability": {},
"cordova-plugin-x-socialsharing": {
"ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-geolocation": {},
"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-plugin-file": {},
"cordova-sqlite-storage": {},
"cordova-plugin-media": {},
"uk.co.workingedge.cordova.plugin.sqliteporter": {},
"cordova-plugin-network-information": {},
"mx.ferreyra.callnumber": {},
"uk.co.workingedge.phonegap.plugin.launchnavigator": {
"GOOGLE_API_KEY_FOR_ANDROID": "dq5sdqs5d4q5sd45qsDD4",
"OKHTTP_VERSION": "3.12.0"
},
"call-number": {},
"cordova-android-play-services-gradle-release": {
"PLAY_SERVICES_VERSION": "16.0.4"
},
"cordova-android-firebase-gradle-release": {
"FIREBASE_VERSION": "16.0.4"
},
"cordova-plugin-firebase": {}
},
"platforms": [
"android"
]
}
}
插件config.xml:
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^3.0.0" />
<plugin name="cordova-plugin-appavailability" spec="0.4.2" />
<plugin name="cordova-plugin-x-socialsharing" spec="5.4.4">
<variable name="ANDROID_SUPPORT_V4_VERSION" value="24.1.1+" />
</plugin>
<plugin name="cordova-plugin-inappbrowser" spec="~3.0.0" />
<plugin name="cordova-plugin-file" spec="6.0.1" />
<plugin name="cordova-plugin-geolocation" spec="^4.0.1" />
<plugin name="cordova-plugin-media" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.1.3" />
<plugin name="cordova-sqlite-storage" spec="3.2.0" />
<plugin name="uk.co.workingedge.cordova.plugin.sqliteporter" spec="~1.1.0" />
<plugin name="cordova-plugin-network-information" spec="2.0.1" />
<plugin name="mx.ferreyra.callnumber" spec="~0.0.2" />
<plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="^3.0.0">
<variable name="GOOGLE_API_KEY_FOR_ANDROID" value="dq5sdqs5d4q5sd45qsDD4" />
<variable name="OKHTTP_VERSION" value="3.12.0" />
</plugin>
<plugin name="cordova-android-play-services-gradle-release" spec="^3.0.0">
<variable name="PLAY_SERVICES_VERSION" value="16.0.4" />
</plugin>
<plugin name="cordova-android-firebase-gradle-release" spec="^3.0.0">
<variable name="FIREBASE_VERSION" value="16.0.4" />
</plugin>
<plugin name="cordova-plugin-firebase" spec="2.0.5" />
<engine name="android" spec="7.1.4" />
答案 0 :(得分:0)
我最终卸载了Freebase库npm uninstall firebase
,安装了旧版本npm install firebase@3.14.0 --save
,并且在卸载了Firebase插件后,我安装了此版本的插件ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
不知道这是否会有所帮助,但这就是我所做的。 好好谈谈Problem with play-services-measurement-base on ionic