ko2ic / image_downloader

Flutter plugin that downloads images and movies on the Internet and saves to Photo Library on iOS or specified directory on Android.
https://pub.dartlang.org/packages/image_downloader#-readme-tab-
MIT License
92 stars 116 forks source link

Issues with AndroidX #5

Closed jesusrp98 closed 5 years ago

jesusrp98 commented 5 years ago

I'm having issues migrating an app to AndroidX, that uses this package. This is the output:

Execution failed for task ':app:preReleaseBuild'.
> Android dependency 'androidx.core:core' has different version for the compile (1.0.0-rc01) and runtime (1.0.1) classpath. You should manually set the same version via DependencyResolution

Is this package migrated to AndroidX? Thanks :)

ko2ic commented 5 years ago

@jesusrp98

Is this package migrated to AndroidX?

Yes. This plugin is dependent on androidx.core: core: 1.0.1. https://github.com/ko2ic/image_downloader/blob/master/android/build.gradle#L45

There should be something dependent on 1.0.0-rc01 in your application.

We use it in applications using various Plugins, but the problem has not happened. So in your application, I do not know exactly how to solve it, but this link may be useful.

jesusrp98 commented 5 years ago

Thank you so much. I finally managed to fix this issue by adding this to: android/build.gradle:

subprojects {
    project.evaluationDependsOn(':app')
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.1.1"
            }
            if (details.requested.group == 'androidx.core'
                    && !details.requested.name.contains('androidx') ) {
                details.useVersion "1.0.1"
            }
        }
    }
}