Ionicでアプリを作っていた時、 cordova-plugin-fcm と cordova-plugin-firebase-analytics プラグインを入れたところ
* What went wrong:
A problem occurred configuring root project 'android'.
> Cannot add task ':processDebugGoogleServices' as a task with that name already exists.
というエラーで動かなくなってしまった。
既にprocessDebugGoogleServicesがあるのに、もう一度立ち上げようとしてるというエラーだったので、相性の問題?と思い検索していたところ
同じような問題に直面している人がいたので対処策が書かれていた。
※ FCMのプラグインの方は既に3.0.0になっているので、Analyticsの対応待ち?問題の根幹がわかってないからなんとも。
https://github.com/sesangsokuro/cordova-plugin-fcm/commit/e1f070d35372e1c65ae0561fbbfd2d16d72a78d6
それぞれのプラグインのgradleファイルのバージョン指定がずれていることに問題があるらしく、対処療法的だけれども cordova-plugin-firebase-analytics の方の com.google.gms:google-services を3.0.0にしてあげることでビルドが通った。
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath 'com.google.gms:google-services:3.0.0'
}
}
一応応急処置したのはこんな感じだよと伝えたかったので、プルリクを送ってみた。こんなんでいいんだろうか。
https://github.com/chemerisuk/cordova-plugin-firebase-analytics/issues/33
https://github.com/chemerisuk/cordova-plugin-firebase-analytics/pull/34