我有这个错误:
任务执行失败':processDebugResources'。 错误:包含名称为“com.google.android.gms.license”的多个库
当我跑步时
离子cordova运行android
这是info ionic:
cli包:(AppData \ Roaming \ npm \ node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
全球套餐:
cordova (Cordova CLI) : 7.1.0
本地包裹:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 6.3.0
Ionic Framework : ionic-angular 3.9.2
系统:
Android SDK Tools : 26.1.1
Node : v6.11.1
npm : 2.15.12
OS : Windows 7
环境变量:
ANDROID_HOME : C:\Users\med\AppData\Local\Android\Sdk
其他:
backend : pro
的package.json:
{
"name": "wetry",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "5.0.3",
"@angular/compiler": "5.0.3",
"@angular/compiler-cli": "5.0.3",
"@angular/core": "5.0.3",
"@angular/forms": "5.0.3",
"@angular/http": "5.0.3",
"@angular/platform-browser": "5.0.3",
"@angular/platform-browser-dynamic": "5.0.3",
"@ionic-native/base64": "^4.5.3",
"@ionic-native/camera": "^4.5.3",
"@ionic-native/core": "4.4.0",
"@ionic-native/file": "^4.5.3",
"@ionic-native/file-transfer": "^4.5.3",
"@ionic-native/google-plus": "^4.6.0",
"@ionic-native/image-picker": "^4.5.3",
"@ionic-native/splash-screen": "4.4.0",
"@ionic-native/status-bar": "4.4.0",
"@ionic/pro": "1.0.20",
"@ionic/storage": "2.1.3",
"com-badrit-base64": "^0.2.0",
"com.synconset.imagepicker": "~2.1.8",
"cordova-plugin-analytics": "^1.4.3",
"cordova-plugin-camera": "^2.4.1",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^2.0.1",
"cordova-plugin-file": "^5.0.0",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-googleplus": "^5.2.1",
"cordova-plugin-inappbrowser": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^1.1.16",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-telerik-imagepicker": "^2.1.8",
"cordova-plugin-whitelist": "^1.3.3",
"cordova.plugins.diagnostic": "^4.0.3",
"font-awesome": "^4.7.0",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"ng2-cordova-oauth": "0.0.8",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18",
"cordova-android": "~6.3.0"
},
"config": {
"ionic_copy": "./config/copy.config.js"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.8",
"typescript": "2.4.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-camera": {},
"cordova-plugin-file": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-compat": {},
"com.synconset.imagepicker": {
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "wetry"
},
"cordova.plugins.diagnostic": {},
"com-badrit-base64": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "id "
},
"cordova-plugin-analytics": {}
},
"platforms": [
"android"
]
}
}
和此:
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.android.support:appcompat-v7:23+"
compile "com.google.android.gms:play-services-analytics:+"
compile "com.android.support:support-v4:24.1.1+"
compile "com.google.android.gms:play-services-auth:+"
compile "com.google.android.gms:play-services-identity:+"
compile "com.android.support:support-v4:26.+"
compile "com.android.support:appcompat-v7:26.+"
// SUB-PROJECT DEPENDENCIES END
}
答案 0 :(得分:6)
Cordova插件没有在gradle构建文件中正确指定依赖项(使用不同的精确版本而不是+)。
我正在使用另一个插件cordova-android-play-services-gradle-release,它以某种方式为我解决了这个问题(讽刺的是它有效:D)。
ionic cordova plugin add cordova-android-play-services-gradle-release
ionic cordova platform add android
ionic cordova platform remove android
上面的命令会添加这个插件,之后你需要重新添加android平台。
编辑(其他解决方案):
如果以上解决方案无法正常工作,您可以尝试使用最新版本或兼容版本(11. +)编辑project.properties文件
target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.android.support:appcompat-v7:23+
cordova.gradle.include.1=com.synconset.imagepicker/myapp-ignorelinterrors.gradle
cordova.gradle.include.2=com.synconset.imagepicker/myapp-androidtarget.gradle
cordova.system.library.2=com.android.support:support-v4:24.1.1+
cordova.system.library.3=com.google.android.gms:play-services-auth:11.+
cordova.system.library.4=com.google.android.gms:play-services-identity:11.+
cordova.system.library.5=com.google.firebase:firebase-core:11.+
cordova.system.library.6=com.google.firebase:firebase-messaging:11.+
cordova.gradle.include.3=cordova-plugin-fcm/myapp-FCMPlugin.gradle
答案 1 :(得分:1)
我也有这个问题,经过长时间的研究后我发现了解决方案
打开文件platform / android / project.properties并检查代码
在我的代码之前
cordova.system.library.2=com.google.android.gms:play-services-analytics:+
在我的代码之后
cordova.system.library.2=com.google.android.gms:play-services-analytics:11.+
它工作正常,谢谢你
答案 2 :(得分:0)
我昨天面临同样的问题.. 我已经通过在build.gradle中添加以下代码解决了这个问题(模块:App(平台/ android))
Add config in android/build.gradle
allprojects {
repositories {
...
configurations.all {
resolutionStrategy {
// Add force (11.4.0 is version you want to use)
force 'com.google.firebase:firebase-messaging:11.4.0'
force 'com.google.firebase:firebase-core:11.4.0'
force 'com.google.android.gms:play-services-gcm:11.4.0'
}
}
}
}
答案 3 :(得分:0)
ionic cordova platform remove android
ionic cordova platform add android@6.4.0
为我工作