首页 > 解决方案 > Error: Android dependency has different version for the compile and runtime classpath

问题描述

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.

标签: androidcordovaionic-frameworkgradlebuild

解决方案


推荐阅读