错误:包名称为com.google.android.gms.license的多个库 [英] Error: more than one library with package name com.google.android.gms.license

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

问题描述

当我尝试运行命令离子cordova build android out错误作为上面的标题时。然后我尝试删除其中一个 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 的依赖关系:

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.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的多个库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆