【问题标题】:error when building cordova android due to plugin conflict由于插件冲突,构建cordova android时出错
【发布时间】:2018-10-20 11:57:00
【问题描述】:

我在构建与插件冲突相关联的 cordova 应用程序时遇到错误。即phonegap-plugin-push 2.2.3。当我删除插件时,一切都会编译。你能帮我理解我做错了什么吗?

编译器错误(cordova build android)

Android Studio project detected
cordova-android-support-gradle-release  ANDROID_SUPPORT_VERSION:  27.0.0
cordova-android-support-gradle-release : WROTE  /Users/xxx/Desktop/VMSharedFolder/Projects/yyy/platforms/android/build.gradle  >  27.0.0
ANDROID_HOME=/Users/xxx/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home
studio

BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
+-----------------------------------------------------------------
| cordova-android-support-gradle-release: 26.+
+-----------------------------------------------------------------
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
    at build_mghwmjggk8ms0ekw8jwhtovo.run(/Users/xxx/Desktop/VMSharedFolder/Projects/yyy/platforms/android/app/build.gradle:149)

FAILURE: Build failed with an exception.

* Where:
Script '/Users/xxx/Desktop/VMSharedFolder/Projects/yyy/platforms/android/cordova-support-google-services/almasport-build.gradle' line: 16

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "11+"

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
/Users/xxx/Desktop/VMSharedFolder/Projects/yyy/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Script '/Users/xxx/Desktop/VMSharedFolder/Projects/yyy/platforms/android/cordova-support-google-services/almasport-build.gradle' line: 16

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "11+"

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

project.proterties

target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.gradle.include.1=cordova-android-support-gradle-release/almasport-cordova-android-support-gradle-release.gradle
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.gradle.include.2=cordova-plugin-code-push/almasport-build-extras.gradle
cordova.gradle.include.3=cordova-plugin-mauron85-background-geolocation/almasport-logtofile.gradle
cordova.system.library.2=com.google.android.gms:play-services-location:11+
cordova.system.library.3=com.android.support:support-v4:23+
cordova.gradle.include.4=cordova-support-google-services/almasport-build.gradle
cordova.gradle.include.5=phonegap-plugin-barcodescanner/almasport-barcodescanner.gradle
cordova.system.library.4=com.android.support:support-v4:27.+
cordova.gradle.include.6=phonegap-plugin-multidex/almasport-multidex.gradle
cordova.system.library.5=com.android.support:support-v13:27.+
cordova.system.library.6=me.leolin:ShortcutBadger:1.1.17@aar
cordova.system.library.7=com.google.firebase:firebase-messaging:11.6.2

Cordova 插件列表

code-push 2.0.6 "CodePushAcquisition"
com.telerik.cordovaPlatformSpecificFiles 0.1.0 "Cordova Platform Specific Files"
cordova-android-support-gradle-release 1.2.0 "cordova-android-support-gradle-release"
cordova-plugin-camera 2.3.1 "Camera"
cordova-plugin-code-push 1.11.12 "CodePush"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-device-motion 1.2.3 "Device Motion"
cordova-plugin-device-orientation 1.0.5 "Device Orientation"
cordova-plugin-dialogs 1.3.1 "Notification"
cordova-plugin-file 4.3.1 "File"
cordova-plugin-file-transfer 1.6.1 "File Transfer"
cordova-plugin-geolocation 2.4.1 "Geolocation"
cordova-plugin-globalization 1.0.5 "Globalization"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-mauron85-background-geolocation 2.3.6 "CDVBackgroundGeolocation"
cordova-plugin-media 2.4.1 "Media"
cordova-plugin-media-capture 1.4.1 "Capture"
cordova-plugin-network-information 1.3.1 "Network Information"
cordova-plugin-splashscreen 4.0.1 "Splashscreen"
cordova-plugin-statusbar 2.2.2-dev "StatusBar"
cordova-plugin-vibration 2.1.3 "Vibration"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-plugin-x-toast 2.6.0 "Toast"
cordova-plugin-zip 3.1.0 "cordova-plugin-zip"
cordova-support-google-services 1.1.0 "cordova-support-google-services"
phonegap-plugin-barcodescanner 8.0.0 "BarcodeScanner"
phonegap-plugin-multidex 1.0.0 "Multidex"
phonegap-plugin-push 2.2.3 "PushPlugin"

cordova 版本 8.1.2

我猜这是个问题:

cordova.system.library.3=com.android.support:support-v4:23+
com.android.support:support-v4:27.+
com.android.support:support-v13:27.+

但我认为它将由 cordova-android-support-gradle-release 1.2.0 插件处理。

所以问题可能与此有关:

com.google.android.gms:play-services-location:11+ com.google.firebase:firebase-messaging:11.6.2

如果我改变了

com.google.android.gms:play-services-location:11+

与

com.google.android.gms:play-services-location:11.6.2,错误消失了。现在我不想每次创建平台时都这样做,有没有办法解释正在发生的事情以及更好的解决方法?

感谢日志家伙

【问题讨论】:

标签: android cordova phonegap-plugin-push


【解决方案1】:

这是一个已知的 phonegap 问题。见More than one library with package name 'com.google.android.gms'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-17
    • 1970-01-01
    • 2019-03-23
    相关资源
    最近更新 更多