shijingsh / react-native-customized-image-picker

iOS/Android image picker with support for camera, video compression, multiple images and cropping
245 stars 59 forks source link

[Android] Ambiguous PickerPackage also defined in @react-native-community/toolbar-android #116

Open HamaniKhalil opened 2 years ago

HamaniKhalil commented 2 years ago

The library seems to have a problem, since it defines a class named PickerPackage that has the exact same name that to @react-native-community/toolbar-android one.

So, the generated PackageList.java file contains imports with two ambiguous classes as following :

...
// react-native-customized-image-picker
import com.mg.app.PickerPackage;
...
// react-native-image-crop-picker
import com.reactnative.ivpusic.imagepicker.PickerPackage;
...

The versions that I'm using for these libraries are :

react-native-customized-image-picker: 1.3.4
@react-native-community/toolbar-android: 0.2.1

A possible fix, maybe to put an alias ahead of the import line with a very specific name, if possible a unique one, so that the problem don't occur int the future with any other libraries. Or else, rename the PickerPackage class.

HamaniKhalil commented 2 years ago

For those who have the same issue, you may have installed both react-native-image-crop-picker and react-native-customized-image-picker libraries, which is the real reason why there's ambiguous class names, and not because of the @react-native-community/toolbar-android as I said in the issue description.

Solution Use one of the two libraries and not both.

Apologies for the mistake. I highly recommend using react-native-customized-image-picker as it's immensely helpful.

Side note I also recommend the maintainers of the project to use a different name to avoid possible ambiguities in the future, the name PickerPackage tends to be quite generic for a class, other purposed libraries may name theirs that way and that may cause a problem for developers to integrate two features they really need in their application.