微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法添加名为“googleServices”的扩展程序,因为已有扩展程序已使用该名称注册 - 离子电容器

如何解决无法添加名为“googleServices”的扩展程序,因为已有扩展程序已使用该名称注册 - 离子电容器

我有一个使用 Ionic Angular 编写的移动应用程序。我的 Ionic 版本是 5。我用 Capacitor 构建它。

我已将 Admob Free 插件添加到我的应用中,并且广告实施工作正常。后来我想将推送通知集成到我的应用中,所以我决定使用 FCM 插件

现在,当我在 Android Studio 中打开项目的 android 平台时,在构建控制台中出现以下错误。请注意,我已将 google-services.json 文件放在正确的位置。

无法添加名为“googleServices”的扩展,因为有 扩展程序已使用该名称注册

app -> build.gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "my.app.id"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
        }
    }
}

repositories {
    maven {
        url  "https://dl.bintray.com/ionic-team/capacitor"
    }
    flatDir{
        dirs '../capacitor-cordova-android-plugins/src/main/libs','libs'
    }
}

dependencies {
    implementation filetree(include: ['*.jar'],dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation project(':capacitor-android')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation project(':capacitor-cordova-android-plugins')
}

apply from: 'capacitor.build.gradle'

apply plugin: 'com.google.gms.google-services'

项目级别 -> build.gradle

buildscript {
    
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.google.gms:google-services:4.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我认为,Admob 插件在内部使用了 google services 插件,当 FCM 插件尝试添加相同的插件时,会发生此错误。如果我错了,请纠正我。

无论如何,有人可以帮我解决这个问题。

谢谢...!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。