Fix dependency resolution errors when I add new packages flutter

Viewed 822

my flutter project were works fine but when some more packages it gives this error dependency resolution
I tried to run

flutter pub cache repair
flutter clean

also I tried to migrate my app to androidX like in here

please any help with tis I'm stack ?? also I will be glad to add more details if any required

this the full log

Launching lib\main.dart on SM A515F in debug mode...
lib\main.dart:1

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.yalantis.ucrop.BuildConfig found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.UCrop found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.UCrop$Options found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.UCropActivity found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.UCropActivity$1 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.UCropActivity$2 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.UCropActivity$3 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.UCropActivity$4 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.UCropActivity$5 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.UCropActivity$6 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)

     Duplicate class com.yalantis.ucrop.UCropActivity$8 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.UCropActivity$GestureTypes found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.callback.BitmapCropCallback found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.callback.BitmapLoadCallback found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.callback.CropBoundsChangeListener found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.callback.OverlayViewChangeListener found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.model.AspectRatio found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.model.AspectRatio$1 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.model.CropParameters found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.model.ExifInfo found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.model.ImageState found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.task.BitmapCropTask found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.task.BitmapLoadTask found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.task.BitmapLoadTask$BitmapWorkerResult found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.util.BitmapLoadUtils found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)

 Duplicate class com.yalantis.ucrop.util.RectUtils found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.util.RotationGestureDetector found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.util.RotationGestureDetector$OnRotationGestureListener found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.util.RotationGestureDetector$SimpleOnRotationGestureListener found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.util.SelectedStateListDrawable found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.CropImageView found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.CropImageView$WrapCropBoundsRunnable found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.CropImageView$ZoomImageToPosition found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.GestureCropImageView found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.GestureCropImageView$1 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.GestureCropImageView$GestureListener found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.GestureCropImageView$RotateListener found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.GestureCropImageView$ScaleListener found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.OverlayView found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.OverlayView$FreestyleMode found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.TransformImageView found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.TransformImageView$1 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.TransformImageView$TransformImageListener found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.UCropView found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.UCropView$1 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.UCropView$2 found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.widget.AspectRatioTextView found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.widget.HorizontalProgressWheelView found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)
     Duplicate class com.yalantis.ucrop.view.widget.HorizontalProgressWheelView$ScrollingListener found in modules jetified-ucrop-2.2.6-runtime (com.github.yalantis:ucrop:2.2.6) and jetified-ucrop-v2.6.1-runtime (com.github.LuckSiege.PictureSelector:ucrop:v2.6.1)

     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8m 19s
Exception: Gradle task assembleDebug failed with exit code 1

and this's my project build.gradle file

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

and this app build.gradle file

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
android {
    compileSdkVersion 29

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.img2pdf"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
        

    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:26.7.0')
    implementation 'com.google.firebase:firebase-analytics'
}
0 Answers
Related