react-native-multiple-image-picker icon indicating copy to clipboard operation
react-native-multiple-image-picker copied to clipboard

Android build - Execution failed for task ':app:checkDebugDuplicateClasses'.

Open roden0609 opened this issue 3 years ago • 4 comments

I got "Execution failed for task ':app:checkDebugDuplicateClasses'." error with android build in 0.4.8. But after I modified the ../node_modules/react-native-photo-editor/android/build.gradle file as below. It can build successfully. Is it need a update version of this library. Thanks.

From: implementation 'com.github.yalantis:ucrop:2.2.2-native' To: compileOnly 'com.github.yalantis:ucrop:2.2.2-native'

Error message below:

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'.

1 exception was raised by workers: java.lang.RuntimeException: Duplicate class com.yalantis.ucrop.UCrop found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCrop$Options found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCropActivity found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCropActivity$1 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCropActivity$2 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCropActivity$3 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCropActivity$4 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCropActivity$5 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCropActivity$6 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCropActivity$7 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCropActivity$8 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.UCropActivity$GestureTypes found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.callback.BitmapCropCallback found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.callback.BitmapLoadCallback found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.callback.CropBoundsChangeListener found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.callback.OverlayViewChangeListener found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.model.AspectRatio found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.model.AspectRatio$1 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.model.CropParameters found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.model.ExifInfo found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.model.ImageState found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.task.BitmapCropTask found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.task.BitmapLoadTask found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.task.BitmapLoadTask$BitmapWorkerResult found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.BitmapLoadUtils found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.CubicEasing found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.EglUtils found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.FastBitmapDrawable found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.ImageHeaderParser found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.ImageHeaderParser$RandomAccessReader found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.ImageHeaderParser$Reader found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.ImageHeaderParser$StreamReader found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.RectUtils found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.RotationGestureDetector found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.RotationGestureDetector$OnRotationGestureListener found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.RotationGestureDetector$SimpleOnRotationGestureListener found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.util.SelectedStateListDrawable found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.CropImageView found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.CropImageView$WrapCropBoundsRunnable found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.CropImageView$ZoomImageToPosition found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.GestureCropImageView found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.GestureCropImageView$1 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.GestureCropImageView$GestureListener found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.GestureCropImageView$RotateListener found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.GestureCropImageView$ScaleListener found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.OverlayView found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.OverlayView$FreestyleMode found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.TransformImageView found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.TransformImageView$1 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.TransformImageView$TransformImageListener found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.UCropView found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.UCropView$1 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.UCropView$2 found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.widget.AspectRatioTextView found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.widget.HorizontalProgressWheelView found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native) Duplicate class com.yalantis.ucrop.view.widget.HorizontalProgressWheelView$ScrollingListener found in modules jetified-pictureselector-v2.7.3-rc08-runtime.jar (io.github.lucksiege:pictureselector:v2.7.3-rc08) and jetified-ucrop-2.2.2-native-runtime.jar (com.github.yalantis:ucrop:2.2.2-native)

Go to the documentation to learn how to Fix dependency resolution errors.

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

roden0609 avatar Nov 04 '21 09:11 roden0609

I tried to solve this but failed. So I added crop image to android in 0.4.8. Documentation is here. And I'm planning to implement crop image in iOS in the next version.

baronha avatar Nov 04 '21 15:11 baronha

This is because pictureselector re-implemented(copy pasted afaik) ucrop internally so it conflicts I solved it by just applyint this patch (using patch-package)

diff --git a/node_modules/react-native-image-crop-picker/android/build.gradle b/node_modules/react-native-image-crop-picker/android/build.gradle
index 48443cc..3d9714f 100644
--- a/node_modules/react-native-image-crop-picker/android/build.gradle
+++ b/node_modules/react-native-image-crop-picker/android/build.gradle
@@ -22,5 +22,5 @@ android {
 dependencies {
     implementation 'com.facebook.react:react-native:+'
     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
-    implementation 'com.github.yalantis:ucrop:2.2.6-native'
+    implementation 'io.github.lucksiege:pictureselector:v2.7.3-rc08'
 }
diff --git a/node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java b/node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java
index c6b09a9..1ff1225 100644
--- a/node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java
+++ b/node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java
@@ -19,6 +19,7 @@ import android.webkit.MimeTypeMap;
 
 import androidx.core.app.ActivityCompat;
 import androidx.core.content.FileProvider;
+import androidx.appcompat.app.AppCompatActivity;
 
 import com.facebook.react.bridge.ActivityEventListener;
 import com.facebook.react.bridge.Callback;
@@ -680,7 +681,7 @@ class PickerModule extends ReactContextBaseJavaModule implements ActivityEventLi
             uCrop.withAspectRatio(width, height);
         }
 
-        uCrop.start(activity);
+        uCrop.start(activity, UCrop.REQUEST_CROP);
     }
 
     private void imagePickerResult(Activity activity, final int requestCode, final int resultCode, final Intent data) {

filipef101 avatar Dec 06 '21 16:12 filipef101

Basically making react native crop picker use pictureselector uCrop instead of ucrop directly. since then both package reference picture selector methods it doesn't conflict anymore 🎉 changeing uCrop.start some other places might be needed, for my use case only here was needed

filipef101 avatar Dec 06 '21 16:12 filipef101

Think this could be solved on app level gradle somehow, any ideas btw? Thinking something like this https://docs.gradle.org/current/userguide/resolution_rules.html#sec:module_replacement

filipef101 avatar Dec 10 '21 12:12 filipef101

Try upgrade to v.1.0.2

baronha avatar Sep 08 '23 05:09 baronha