Ionic3: more than one library with the package name 'com.google.android.gms.license'

I have this error:

Execution failed for task ': processDebugResources'. Error: more than one library with package name "com.google.android.gms.license"

when i started

Ion cordova run android

This is ionic information:

cli packages: (AppData \ Roaming \ npm \ node_modules)

@ionic/cli-utils : 1.19.2 ionic (Ionic CLI) : 3.20.0 

global packages:

 cordova (Cordova CLI) : 7.1.0 

local packages:

 @ionic/app-scripts : 3.1.8 Cordova Platforms : android 6.3.0 Ionic Framework : ionic-angular 3.9.2 

System:

 Android SDK Tools : 26.1.1 Node : v6.11.1 npm : 2.15.12 OS : Windows 7 

Environment Variables:

 ANDROID_HOME : C:\Users\med\AppData\Local\Android\Sdk 

Miscellaneous:

 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" ] } } 

and this:

 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 

}

+5
source share
4 answers

This is a mess with Cordoba plugins that do not set dependencies properly in their gradle build files (using different exact versions instead of +).

I use this another cordova-android-play-services-gradle-release plugin that somehow fixes the problem for me (ya ... the irony works: D).

 ionic cordova plugin add cordova-android-play-services-gradle-release ionic cordova platform add android ionic cordova platform remove android 

This plugin will be added above the commands, after which you will need to add the Android platform again.

Edit (another solution):

Instead, you can try editing the project.properties file with the latest or compatible version (11. +) if the above solution does not work.

 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 
+4
source

I also had this problem, after much research, I figured out a solution

open the file platform /android/project.properties and check the code

before my code cordova.system.library.2=com.google.android.gms:play-services-analytics:+

after my code cordova.system.library.2=com.google.android.gms:play-services-analytics:11.+

it works great thank you

+1
source

I came across the same issue from yesterday. I fixed this problem by adding the below code in build.gradle (Module: App (Platforms and 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' } } } } 
0
source
 ionic cordova platform remove android ionic cordova platform add android@6.4.0 

Worked for me

0
source

Source: https://habr.com/ru/post/1275998/


All Articles