1

I have a ionic cordova project. I use the following command to build my app:

ionic cordova build android -- --xwalk64bit --release

I get this error: Android dependency dependencyName has different version for the compile Vx and runtime Vy classpath.

I tried these solutions:

Android dependency has different version for the compile and runtime

The only solution that half works is adding implementation to the dependencies. However when i launch the build command cordova replaces the name and version of my packages by 27.+:

implementation "com.android.support:support-v4:27.1.1"
implementation "com.android.support:support-fragment:26.1.0"
implementation "com.android.support:support-core-ui:26.1.0"
implementation "com.android.support:support-core-utils:26.1.0"
implementation "com.android.support:support-media-compat:26.1.0"
implementation "com.android.support:support-compat:26.1.0"

by

implementation27.+"
implementation27.+"
implementation27.+"
implementation27.+"
implementation27.+"
implementation27.+"

Then the build fails with a parsing error.

Using:

allprojects {
   //...
    configurations.all {
        resolutionStrategy.force "com.android.support:support-v4:27.1.1"
   // etc.
    }
}

doesn't work. Using:

configurations.all {
  resolutionStrategy.eachDependency { details ->
      if (details.requested.group == 'com.android.support'
              && !details.requested.name.contains('multidex') ) {
          details.useVersion "26.1.0"
      }
  }
}

doesn't work either.

Help appreciated.

Thibault Savary
  • 151
  • 2
  • 8
  • I'm having the same issue. Did you managed to solve it already? – mluis Jul 04 '19 at 12:38
  • I build with ionic then Ctrl+Z in android studio to revert the versions and build... Basically once the assets are build with ionic you ignore the error and pursue build in android studio. If you can't figured it out let me know more precisely what is your issue. – Thibault Savary Jul 05 '19 at 13:45
  • I had this cordova-android-support-gradle-release plugin installed. I was able to build everything removing it and also removing duplicated java files under platform/android/CordovaLib project. Solved this issue: https://stackoverflow.com/questions/56891957/d8-program-type-already-present-org-apache-cordova-buildhelper?noredirect=1#comment100346521_56891957 – mluis Jul 05 '19 at 14:08
  • Nice, I have this plugin too I think, I'll check if this works w/o it. – Thibault Savary Jul 05 '19 at 14:12
  • I also had another plugin which was onesignal-cordova-plugin that states it does the same of cordova-android-support-gradle-release in one of its submodules.. so I was in a bit of a mess lol – mluis Jul 05 '19 at 14:24
  • I have the same plugin installed too. Thanks for your input. – Thibault Savary Jul 12 '19 at 07:52

0 Answers0