-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict in libraries image: ^4.2.0 when used with crop_your_image: ^1.0.2 #653
Comments
Just reverted back to image: ^4.1.7 and still getting the same error. crop_your_image library didn't change from crop_your_image: ^1.0.2, I did flutter clean and flutter pub get and still getting the error, a half an hour everything was working great until I decided to update pubspec and then this started happening. |
I don't know crop_your_image, but the Dart way to avoid naming conflicts is to use namespaced imports. |
Thank you for answering but I'm not getting any indications of errors inside the classes where they're being used and I already have namespaced imports for image specifically, but not for crop_your_image. No class is returning errors and this error message comes up during compile not when updating pubspec as I said above. The weird thing is even after downgrading back to image: ^4.1.7 I'm still getting the error even after flutter clean and flutter pub get. I don't get it. |
I did Still getting the same error even after reverting to the version that was working image: ^4.1.7 import 'package:crop_your_image/crop_your_image.dart'; I don't get it why reverting back doesn't fix the error. |
ImageFormat was added in 4.2.0. But the error you first posted indicated there is an I wish dart had code namespaces in addition to import namespaces. |
I think the import is happening by crop_your_image. Maybe I'll rename my class. |
"I wish dart had code namespaces in addition to import namespaces." I don't know what the best course of action would be but if you could rename the class and that would solve the problem that would be great. Please before you do go through all of that just check if this same problem occurs on your end too. I can't compile my project anymore because of this which means unless I find a fix I'll have to wait until you rename the class as it's an integral part of the app and thank you for making it. I just don't understand why reverting back didn't solve the problem, so there might be more going on here? |
Reverting to image < 4.2.0 should work because there is no ImageFormat enum before then. So it must be a cache ghost haunting you. |
I'm surprised issues like this don't come up more often. It's not like I was super creative with my naming "Image". To be fare, I wrote this over 10 years ago, before Dart was even 1.0. There was no Flutter back then, and only a handful of libraries on pub. And naming things is hard. |
I'm going to try a couple of things, will report back, must be the cache yeah
Haha, the naming is precise and on point, great job on that =) but yeah I was surprised when I saw the name that they allowed that and they didn't take it for themselves for some official library, it's good though still that naming doesn't come up that often as a problem, I seem to have a propensity for encountering problems though so here we are, lol. Will report back soon about the cache and reverting back. |
Well, I tried Invalidate Caches, didn't help, then tried to delete C:\Users\Computer.gradle\caches, now I get this Launching lib\main.dart on sdk gphone64 x86 64 in debug mode... FAILURE: Build failed with an exception.
BUILD FAILED in 4s Probably shouldn't have done that. I'll probably reinstall Android Studio and flutter and write back tomorrow. |
I would think it's a pub cache thing rather than a gradle thing, but I have very minimal knowledge of gradle, or flutter. |
Or maybe change your pubspec to use a specific version of image. I only know enough about pub to be dangerous. |
I reinstalled Android Studio, still got the same error. I tried making a new project, imported image and crop_your_image and a class where I'm using it and there's no conflict in the new project so now I have no clue what's going on. |
The easiest fix would be to fix crop_your_image. I'll file an issue over there, chooyan-eng/crop_your_image#157. Hopefully they can put out a quick fix by namespacing the image import in their package. I could rename the enum on my end, but I would probably make other people angry. |
It seems crop_your_image users encountered the same conflict [https://github.com/chooyan-eng/crop_your_image/issues/155] the developer already published a new version 1.1.0, for some reason pubspec recommends 1.0.2, it's not until I went to pubdev that I saw there was a 1.1.0 version there. Now there's no more conflict. I'm getting another error now not connected to this library, so onto solving. Thank you for responding so fast! |
I'm glad he got a fix out, and I'm sorry you're having so many troubles. Package management is a dark art, I don't think anyone's really gotten it figured out. And I'm prone to breaking things, an unfortunate result that I haven't even done any Dart programming in years other than supporting these libraries. I do enjoy working on them though, and I'm glad people find them useful. |
/C:/Users/Computer/AppData/Local/Pub/Cache/hosted/pub.dev/crop_your_image-1.0.2/lib/src/logic/cropper/image_image_cropper.dart:13:1: Error: 'ImageFormat' is imported from both 'package:crop_your_image/src/logic/format_detector/format.dart' and 'package:image/src/formats/image_format.dart'.
import 'package:image/image.dart';
^^^^^^^^^^^
/C:/Users/Computer/AppData/Local/Pub/Cache/hosted/pub.dev/crop_your_image-1.0.2/lib/src/logic/cropper/image_image_cropper.dart:24:32: Error: Not a constant expression.
ImageFormat outputFormat = ImageFormat.jpeg,
^^^^^^^^^^^
/C:/Users/Computer/AppData/Local/Pub/Cache/hosted/pub.dev/crop_your_image-1.0.2/lib/src/logic/cropper/image_image_cropper.dart:24:32: Error: 'ImageFormat' is imported from both 'package:crop_your_image/src/logic/format_detector/format.dart' and 'package:image/src/formats/image_format.dart'.
ImageFormat outputFormat = ImageFormat.jpeg,
^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
Execution failed for task ':app:compileFlutterBuildDebug'.
BUILD FAILED in 1m 21s
Error: Gradle task assembleDebug failed with exit code 1
Error appeared when trying to get dependencies to update pubspec
when using
image: ^4.2.0
with
crop_your_image: ^1.0.2
There was no conflict in the version image: ^4.1.7
The text was updated successfully, but these errors were encountered: