问题描述
我有一个使用 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 (将#修改为@)