web-dev-qa-db-fra.com

ionic3: plusieurs bibliothèques portant le nom de package 'com.google.Android.gms.license'

J'ai cette erreur:

L'exécution a échoué pour la tâche ': processDebugResources'. Erreur: plusieurs bibliothèques portant le nom de package 'com.google.Android.gms.license'.

quand j'ai couru 

cordova ionique sous Android

c'est info ionique:

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

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

forfaits globaux:

cordova (Cordova CLI) : 7.1.0

forfaits locaux:

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

Système:

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

Variables d'environnement:

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

et ça:

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
sf_2018

C'est un désordre avec les plugins Cordova ne spécifiant pas correctement les dépendances dans leurs fichiers de construction de dégradés (en utilisant différentes versions exactes au lieu de +). 

J'utilise ceci un autre plugin cordova-Android-play-services-gradle-release qui résout en quelque sorte le problème pour moi (ya ... ironie ça marche: D).

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

Les commandes ci-dessus ajouteront ce plugin, après quoi vous devrez rajouter la plateforme Android. 

Modifier (autre solution):

Vous pouvez plutôt essayer d’éditer le fichier project.properties avec la version la plus récente ou compatible (11. +) si la solution ci-dessus ne fonctionne pas.

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
6
Sebin Benjamin

j'ai aussi eu ce problème, après de longues recherches, j'ai trouvé la solution 

ouvrez le fichier plateforme/Android/project.properties et vérifiez le code

avant mon code cordova.system.library.2=com.google.Android.gms:play-services-analytics:+

après mon code cordova.system.library.2=com.google.Android.gms:play-services-analytics:11.+

ça marche bien, merci

1
sathish

Hier, je faisais face au même problème. J'ai résolu ce problème en ajoutant le code ci-dessous dans build.gradle (Module: App (Platforms/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'
        }
    }
  }
}
ionic cordova platform remove Android

ionic cordova platform add [email protected]

A travaillé pour moi

0
Umesh Patadiya