科尔多瓦Android:无法应用插件[class'com.google.gms.googleservices.GoogleServicesPlugin']

时间:2019-04-12 15:07:46

标签: android cordova ionic-framework build

我有一个无法构建android平台的问题。 我试图删除并重新添加它,但是它不起作用。 还发现也许这是一个火力基地冲突?有些人设法通过删除Firebase,删除平台,添加平台和安装Firebase插件来解决该问题,但对我不起作用。

这是我尝试构建时遇到的错误:

Preparing Firebase on Android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=D:\Program Files\Android\SDK (recommended setting)
ANDROID_HOME=D:\Program Files\Android\SDK (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app

FAILURE: Build failed with an exception.

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
* Where:
Script 'D:\workspace\iganalytics\app\platforms\android\cordova-support-google-services\starter-build.gradle' line: 17

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > Cannot add extension with name 'googleServices', as there is an extension already registered with that name.

* 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 1s
D:\workspace\iganalytics\app\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Script 'D:\workspace\iganalytics\app\platforms\android\cordova-support-google-services\starter-build.gradle' line: 17

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > Cannot add extension with name 'googleServices', as there is an extension already registered with that name.

* 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 1s

这是cordova-support-google-services \ starter-build.gradle文件:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.google.gms:google-services:4.2.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
}

我也试图对此行发表评论:

apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

但是它也不起作用。 谢谢您的帮助

0 个答案:

没有答案