Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic3: more than one library with package name 'com.google.android.gms.license' [duplicate]

I have this error:

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

when i have run

ionic cordova run android

this is info ionic:

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

Misc:

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

}

like image 658
sf_2018 Avatar asked Mar 21 '18 11:03

sf_2018


2 Answers

It's a mess with Cordova plugins not specifying dependencies properly in their gradle build files (using different exact versions instead of +).

I'm using this another plugin cordova-android-play-services-gradle-release which somehow fixes the issue for me (ya...irony it works :D).

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

Above commands will add this plugin, after which you need to re-add android platform.

Edit (other solution):

You can instead try editing the project.properties file with the latest or compatible version (11.+) if the above solution doesn't 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
like image 144
Sebin Benjamin Avatar answered Oct 13 '22 01:10

Sebin Benjamin


i too had this problem , after long research i found out the 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's working fine ,thanks you

like image 43
sathish Avatar answered Oct 12 '22 23:10

sathish