dpa99c/cordova-android-support-gradle-release

Android dependency has different version for the compile and runtime classpath

mluis opened this issue · 1 comments

mluis commented

I'm submitting a ... (check one with "x"):

  • bug report
  • feature request
  • documentation issue

Bug report

Current behavior:

After installing the plugin:

 cordova-android-support-gradle-release: 27.+

I'm getting:

Android dependency 'com.android.support:appcompat-v7' has different version for the compile (28.0.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution

Expected behavior:

Build successfully.

Steps to reproduce:

Create a new ionic-v1 cordova android project.
Install the plugin.
Try to compile.

Environment information

  • Cordova CLI version
    • cordova -v
      9.0.0
  • Cordova platform version
    • cordova platform ls
      Installed platforms:
      android 8.0.0
      ios 5.0.1
  • Plugins & versions installed in project (including this plugin)
    • cordova plugin ls
      cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release"
      cordova-plugin-compat 1.2.0 "Compat"
      cordova-plugin-device 1.1.6 "Device"
      cordova-plugin-geolocation 2.4.3 "Geolocation"
      cordova-plugin-network-information 1.3.3 "Network Information"
      cordova-plugin-screen-orientation 3.0.1 "Screen Orientation"
      cordova-plugin-splashscreen 5.0.2 "Splashscreen"
      cordova-plugin-statusbar 2.2.3 "StatusBar"
      cordova-plugin-whitelist 1.3.2 "Whitelist"
      cordova.plugins.diagnostic 4.0.12 "Diagnostic"
      es6-promise-plugin 4.2.2 "Promise"
      ionic-plugin-keyboard 2.2.1 "Keyboard"
      onesignal-cordova-plugin 2.4.7 "OneSignal Push Notifications"
  • Dev machine OS and version, e.g.
    • OSX
      • sw_vers
        ProductName: Mac OS X
        ProductVersion: 10.13.6
        BuildVersion: 17G7024

Android build issue:

  • Node JS version
    • node -v
      v11.3.0
  • Gradle version
    • ls platforms/android/.gradle
      4.10.3 5.5 buildOutputCleanup vcs-1
  • Target Android SDK version
    • android:targetSdkVersion in AndroidManifest.xml
      28
  • Android SDK details
    • sdkmanager --list | sed -e '/Available Packages/q'
      Installed packages:=====================] 100% Computing updates...
      Path | Version | Description | Location
      ------- | ------- | ------- | -------
      build-tools;26.0.2 | 26.0.2 | Android SDK Build-Tools 26.0.2 | build-tools/26.0.2/
      build-tools;27.0.1 | 27.0.1 | Android SDK Build-Tools 27.0.1 | build-tools/27.0.1/
      build-tools;28.0.3 | 28.0.3 | Android SDK Build-Tools 28.0.3 | build-tools/28.0.3/
      emulator | 29.0.11 | Android Emulator | emulator/
      extras;android;m2repository | 47.0.0 | Android Support Repository | extras/android/m2repository/
      extras;google;m2repository | 58 | Google Repository | extras/google/m2repository/
      extras;intel;Hardware_Accelerated_Execution_Manager | 7.3.2 | Intel x86 Emulator Accelerator (HAXM installer) | extras/intel/Hardware_Accelerated_Execution_Manager/
      extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2 | 1 | Solver for ConstraintLayout 1.0.2 | extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2/
      extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2 | 1 | ConstraintLayout for Android 1.0.2 | extras/m2repository/com/android/support/constraint/constraint-layout/1.0.2/
      patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/
      platform-tools | 29.0.1 | Android SDK Platform-Tools | platform-tools/
      platforms;android-16 | 5 | Android SDK Platform 16 | platforms/android-16/
      platforms;android-25 | 3 | Android SDK Platform 25 | platforms/android-25/
      platforms;android-26 | 2 | Android SDK Platform 26 | platforms/android-26/
      platforms;android-27 | 3 | Android SDK Platform 27 | platforms/android-27/
      platforms;android-28 | 6 | Android SDK Platform 28 | platforms/android-28/
      sources;android-16 | 2 | Sources for Android 16 | sources/android-16/
      system-images;android-27;google_apis;x86 | 9 | Google APIs Intel x86 Atom System Image | system-images/android-27/google_apis/x86/
      tools | 26.1.1 | Android SDK Tools | tools/

Available Packages:

Console output

FAILURE: Build failed with an exception.
  • What went wrong:
    Execution failed for task ':app:preDebugBuild'.

Android dependency 'com.android.support:appcompat-v7' has different version for the compile (28.0.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution



Other information:

StackOverflow

Thank you.

The onesignal-cordova-plugin you have included in your build includes the OneSignal Gradle Plugin which, as it says in its documented features:

  • Automatically aligns versions of module dependencies under the same group. This fixes compile and runtime errors due to mismatched interdependencies.
    Applies to the following libraries:
    • com.google.android.gms
    • com.google.firebase
    • com.android.support
  • Ensures com.android.support is never higher than compileSdkVersion

Therefore this is overriding the Gradle settings applied by this plugin (in your case 27.+).

This plugin is being overridden by the OneSignal Gradle plugin and there's nothing that can be done within this plugin to change that.
If you build is failing without this plugin present, you should raise an issue against the OneSignal Gradle plugin since it claims to resolve such issues itself.