首页 > 解决方案 > Transloadit Dependency has different version for the compile (x) and runtime (y)

问题描述

I want to add the transloadit android sdk. The gradle build fails with the following error:

Android dependency 'io.tus.android.client:tus-android-client' has different version for the compile (0.1.5) and runtime (0.1.7) classpath. You should manually set the same version via DependencyResolution

I already use the dependencyResolution for the support library but I'm not sure what to do with transloadit. This is what I have so far.

configurations.all {
    resolutionStrategy.force "com.android.support:support-v4:28.0.0"
    resolutionStrategy.force "com.android.support:appcompat-v7:28.0.0"
}

标签: androidgradletransloadit

解决方案


I found a different version of the same library in one of the submodules that caused the problem.

In my case a was able to remove the other dependency. But if you have library that uses i.e. an older version of a library you have to use you can do the following:

As described here -> https://developer.android.com/studio/build/gradle-tips#configure-project-wide-properties

you can override the version number of libraries used in submodules and libraries by adding ext in your root folder and specify which version should be used. In my case I override the versions for android v4 and v7 support libraries and the play-service-location library.

Here is what I had to add to my root gradle file

ext {
    compileSdkVersion = 28
    supportLibVersion = "28.0.0"
    googleMapsLibVersion = "16.0.0"
}
allprojects {
    repositories {
        google()
        jcenter()
    }
    configurations.all {
        resolutionStrategy.force "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
        resolutionStrategy.force "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
        resolutionStrategy.force "com.google.android.gms:play-services-location:${rootProject.ext.googleMapsLibVersion}"
    }
}

and in my module "app" I can use these versions as well

implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:support-v13:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
implementation "com.google.android.gms:play-services-location:${rootProject.ext.googleMapsLibVersion}"
implementation "com.google.android.gms:play-services-maps:${rootProject.ext.googleMapsLibVersion}"

推荐阅读