问题描述
当我尝试运行命令 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!