android - ionic ( Cordova ): Gradle: more than one library with package name 'com.google.android.gms'

标签 android cordova ionic-framework build.gradle

我在执行Ionic run android时遇到错误,错误如下

Error: more than one library with package name 'com.google.android.gms' You can temporarily disable this error with android.enforceUniquePackageName=fal se However, this is temporary and will be enforced in 1.0`

这是我添加的插件

com.google.playservices 21.0.1 "Google Play Services for Android"
com.ionic.keyboard 1.0.4 "Keyboard"
com.phonegap.plugins.facebookconnect 0.11.0 "Facebook Connect"com.transistorsoft.cordova.background-geolocation 0.5.11 "BackgroundGeolocation"
cordova-plugin-camera 1.2.0 "Camera"
cordova-plugin-console 1.0.1 "Console"
cordova-plugin-device 1.0.1 "Device"
cordova-plugin-dialogs 1.1.1 "Notification"
cordova-plugin-file 2.1.0 "File"
cordova-plugin-file-transfer 1.2.1 "File Transfer"
cordova-plugin-geolocation 1.0.1 "Geolocation"
cordova-plugin-network-information 1.0.1 "Network Information"
cordova-plugin-splashscreen 2.1.0 "Splashscreen"
cordova-plugin-whitelist 1.0.0 "Whitelist"
de.appplant.cordova.plugin.email-composer 0.8.3dev "EmailComposer"
de.neofonie.cordova.plugin.nativeaudio 3.1.0 "Cordova Native Audio"
nl.x-services.plugins.googleplus 1.1.2 "Google+"
nl.x-services.plugins.socialsharing 4.3.19 "SocialSharing"
nl.x-services.plugins.toast 2.1.1 "Toast"
onesignal-cordova-plugin 1.9.0 "OneSignal Push Notifications"

这里是我的 build.gradle 依赖项

//生成的文件!不要编辑!

...

dependencies{
compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile project(path: ":CordovaLib", configuration: "debug")
releaseCompile project(path: ":CordovaLib", configuration: "release")
debugCompile project(path: ":com.phonegap.plugins.facebookconnect:oauth634839-FacebookLib", configuration: "debug")
releaseCompile project(path: ":com.phonegap.plugins.facebookconnect:oauth634839-FacebookLib", configuration: "release")
debugCompile project(path: ":com.google.playservices:oauth634839-google-play-services_lib", configuration: "debug")
releaseCompile project(path: ":com.google.playservices:oauth634839-google-play-services_lib", configuration: "release")
compile "com.google.android.gms:play-services-gcm:7.3.0" 
compile "com.google.android.gms:play-services-analytics:7.3.0" 
// SUB-PROJECT DEPENDENCIES END
}

...

我知道错误来自这里,但我不知道如何让单个包 com.google.android.gms,当我知道我没有直接编辑文件 build.gradle

谢谢。

最佳答案

如果有人遇到同样的问题,这里是解决方案,https://documentation.onesignal.com/docs/troubleshooting-cordova-variants#section-clean-build 问题出在“one signal”模块

关于android - ionic ( Cordova ): Gradle: more than one library with package name 'com.google.android.gms' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32567913/

相关文章:

javascript - 如何将匿名 firebase 凭证保存到本地存储以外的其他地方?

android - 基于现有布局以编程方式添加按钮

android - 为什么在使用 android-support-v4 时找不到 android.util.LruCache.*?

android - phonegap android 应用程序因打开相机时内存不足而崩溃

java - 我得到 "' :mergeDebugAssets"-Error when compiling my App with Ionic

node.js - Ionic 5.4.16 无法在 Node 12.19.0 @ Ubuntu 20.04 上运行

java - 尝试创建 fragment 类

Android Honeycomb,获取 fragment 实例?

android - PhoneGap 和谷歌地图 API V3 "Disabled?"

ios - 在 iOS 上第二次打开 ionic 应用程序,应用程序无法运行