错误:多个库的包名称为 com.google.android.gms.license

Error: more than one library with package name com.google.android.gms.license(错误:多个库的包名称为 com.google.android.gms.license)
本文介绍了错误:多个库的包名称为 com.google.android.gms.license的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行命令 ionic cordova build android 时出现如上标题所示的错误.然后我尝试删除其中一个 gms,当我再次构建时,删除它再次出现.如何解决这个问题?

When I try to run the command ionic cordova build android out error as title above. Then I try to remove one of the gms, when I build again the deleted it appears again. how to solve this?.

这是我的 build.gradle 的依赖项:

Here is my dependencies of my 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"))
    compile "com.google.android.gms:play-services-auth:+" // i remove this
    compile "com.google.android.gms:play-services-identity:+"
    compile "com.facebook.android:facebook-android-sdk:4.+"
    // SUB-PROJECT DEPENDENCIES END
}

推荐答案

我最近遇到了这个问题,对我来说问题是由于某种原因,android project.properties 文件是为 com.xml 生成的不同版本的.google.android.gms,例如:

I've faced this issue quite recently and the problem for me was that for some reason the android project.properties file was generated with different versions for the com.google.android.gms, as such:

target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.google.android.gms:play-services-auth:+
cordova.system.library.3=com.google.android.gms:play-services-identity:+
cordova.system.library.4=com.google.android.gms:play-services-location:11.+

这使得 library.2 和 library.3 需要一个版本,而 library.4 需要一个更具体的版本,从而导致在编译期间重复库引用.

This makes the library.2 and library.3 require one version while the library.4 requires a more specific version, thus causing the duplicate library reference during compiling.

虽然我不认为这应该是最终解决方案,但添加特定库对我有用.因此:

While I don't think this should be the final solution, adding the specific library worked for me. As such:

target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.google.android.gms:play-services-auth:11.+
cordova.system.library.3=com.google.android.gms:play-services-identity:11.+
cordova.system.library.4=com.google.android.gms:play-services-location:11.+

这篇关于错误:多个库的包名称为 com.google.android.gms.license的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)