我在离子应用程序(https://ionicframework.com/docs/v3/native/firebase/)中安装了Firebase
安装@ ionic-native / firebase后,该应用停止构建(Android版本)
然后我跑步
ionic cordova构建android --prod --release
或
ionic cordova运行android
这些错误出现在控制台中
> Configure project :app
WARNING: The onesignal-gradle-plugin MUST be before com.android.application!
Please put onesignal-gradle-plugin first OR update to com.android.tools.build:gradle:3.0.0 or newer!
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
FAILURE: Build failed with an exception.
* Where:
Script 'app/platforms/android/cordova-support-google-services/app-build.gradle' line: 16
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
> For input string: "+"
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Command finished with error code 1: app/platforms/android/gradlew cdvBuildDebug,-b,app/platforms/android/build.gradle
app/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* Where:
Script 'app/platforms/android/cordova-support-google-services/app-build.gradle' line: 16
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
> For input string: "+"
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Error: app/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* Where:
Script 'app/platforms/android/cordova-support-google-services/app-build.gradle' line: 16
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
> For input string: "+"
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
at ChildProcess.whenDone (app/node_modules/cordova-common/src/superspawn.js:125:23)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:927:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
[ERROR] An error occurred while running subprocess cordova.
cordova run android --verbose exited with exit code 1.
我在package.json中的依赖项
"dependencies": {
"@angular/common": "4.1.3",
"@angular/compiler": "4.1.3",
"@angular/compiler-cli": "4.1.3",
"@angular/core": "4.1.3",
"@angular/forms": "4.1.3",
"@angular/http": "4.1.3",
"@angular/platform-browser": "4.1.3",
"@angular/platform-browser-dynamic": "4.1.3",
"@ionic-native/core": "4.3.2",
"@ionic-native/facebook": "^4.2.1",
"@ionic-native/firebase": "3.14.0",
"@ionic-native/firebase-analytics": "^4.5.3",
"@ionic-native/in-app-browser": "^4.4.2",
"@ionic-native/keyboard": "^4.5.2",
"@ionic-native/onesignal": "^4.5.3",
"@ionic-native/social-sharing": "^4.2.1",
"@ionic-native/splash-screen": "3.12.1",
"@ionic-native/status-bar": "3.12.1",
"@ionic/storage": "2.0.1",
"@types/route-parser": "^0.1.1",
"cordova-android": "8.0.0",
"cordova-browser": "5.0.3",
"cordova-custom-config": "^5.1.0",
"cordova-ios": "4.5.4",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-customurlscheme": "^4.4.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-facebook4": "^1.10.1",
"cordova-plugin-firebase": "2.0.5",
"cordova-plugin-firebase-analytics": "^0.12.1",
"cordova-plugin-inappbrowser": "^1.7.2",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-x-socialsharing": "^5.4.1",
"cordova-support-google-services": "^1.0.0",
"es6-promise-plugin": "^4.2.2",
"font-awesome": "^4.7.0",
"fractional": "^1.0.0",
"humps": "^2.0.1",
"ionic-angular": "3.7.1",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"lodash": "^4.17.5",
"onesignal-cordova-plugin": "^2.4.1",
"pluralize": "^7.0.0",
"route-parser": "0.0.5",
"rxjs": "5.4.0",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.12"
},
"devDependencies": {
"@ionic/app-scripts": "3.2.3",
"typescript": "2.3.4"
},
"description": "Hybrid App",
"config": {
"ionic_copy": "./config/copy.config.js"
},
"cordova": {
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-x-socialsharing": {},
"cordova-plugin-facebook4": {
"APP_ID": "xxxxxxxxxxxx",
"APP_NAME": "xxxxxxx"
},
"cordova-plugin-ionic-webview": {},
"cordova-support-google-services": {},
"cordova-plugin-firebase-analytics": {
"FIREBASE_VERSION": "11.0.+"
},
"onesignal-cordova-plugin": {},
"cordova-plugin-customurlscheme": {
"URL_SCHEME": "xxxxxxx",
"ANDROID_SCHEME": " ",
"ANDROID_HOST": " ",
"ANDROID_PATHPREFIX": "/"
},
"cordova-custom-config": {},
"cordova-plugin-firebase": {}
},
"platforms": [
"browser",
"ios",
"android"
]
}
离子信息
Ionic:
ionic (Ionic CLI) : 4.12.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.7.1
@ionic/app-scripts : 3.2.3
Cordova:
cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-webview 1.2.1, (and 13 other plugins)
app / platforms / android / cordova-support-google-services / app-build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath 'com.google.gms:google-services:3.1.0'
}
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
ext.postBuildExtras = {
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}
不可能找到解决方案,也许有人遇到了 这个问题,将有助于解决。
谢谢!