I use Ionic 3.4.0
to build android app, when I follow FCM firebase plugin docs
I get error during building android app. I did following:
1 Install plugin:
ionic cordova plugin add cordova-plugin-fcm
npm install --save @ionic-native/fcm
2 Run build android app:
ionic cordova build android
3 I got following error:
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit code 1):
ANDROID_HOME=/home/tong/eproject/android
JAVA_HOME=/usr/lib/jvm/java-8-oracle/
Subproject Path: CordovaLib
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default
version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use
Task.doLast(Action) instead.
at
build_6dhr8ioykw4yco44wd3y0fmi8.run(/home/tong/eproject/ionic/MyInoicProject/platforms/android/build.gradle:138)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please
use TaskInputs.file(Object).skipWhenEmpty() instead.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugApkCopy'.
> Could not find com.google.firebase:firebase-core:9.0.0.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-core:+ as no versions of
com.google.firebase:firebase-core are available.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-messaging:+ as no versions of
com.google.firebase:firebase-messaging are available.
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 24.847 secs
Error: /home/tong/eproject/ionic/MyInoicProject/platforms/android/gradlew: Command failed with exit code 1 Error
output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugApkCopy'.
> Could not find com.google.firebase:firebase-core:9.0.0.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-core:+ as no versions of
com.google.firebase:firebase-core are available.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-messaging:+ as no versions of
com.google.firebase:firebase-messaging are available.
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
It seems like I am missing com.google.firebase:firebase-core:9.0.0
I read from this post but it does not work when I try to update google services. Please help me thanks.