LoginSignup
0
1

More than 5 years have passed since last update.

CordovaのFirebase系プラグインがAndroidで動かなかった問題

Last updated at Posted at 2017-06-28

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にしてあげることでビルドが通った。

[/plugins/cordova-plugin-firebase-analytics/src/android/build.gradle]
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

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1