CanHub / Android-Image-Cropper

Image Cropping Library for Android, optimised for Camera / Gallery.
Apache License 2.0
1.21k stars 249 forks source link

Cannot build with Java 8, which breaks some CI builds #281

Closed nokite closed 2 years ago

nokite commented 2 years ago

Describe the bug The build fails on machines that have Java 8

To Reproduce

  1. Take an Android project that successfully builds on a particular machine with JDK 8.
  2. The project targets Java 8 (1.8). It uses gradle plugin 4.2.2, gradle 6.9, jettifier (with desugar_jdk_libs)
  3. Add the Android-Image-Cropper library to the project.
  4. Start a build on the CI and see the results - the build fails (see the log below)

Expected behavior The build should succeed, the same way as before adding the library.

Additional context

> Task :app:kaptDevelopmentDebugKotlin
/.../app/build/generated/data_binding_base_class_source_out/developmentDebug/out/.../databinding/ActivityImageCropperBinding.java:13: error: cannot access CropImageView
import com.canhub.cropper.CropImageView;
                         ^
  bad class file: /private/var/root/.gradle/caches/transforms-3/fbc.../transformed/jetified-Android-Image-Cropper-3.3.6-api.jar(com/canhub/cropper/CropImageView.class)
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.

Version 55 corresponds to Java 11, and 52 corresponds to Java 8.

Canato commented 2 years ago

Please check https://github.com/CanHub/Android-Image-Cropper/issues/260 and let me know what you think =D

nokite commented 2 years ago

@Canato Thanks for the link! (my initial search filter had "is:open", which mislead me and I thought this hadn't been reported)

The change to the updated stack is a good thing, but I think it may have been premature (Java Android 12 + Gradle 7.0.1 + Java 11). It's probably better to keep the library compatible for a while. I have no idea if compatibility with Java 8 can be ensured with the new stack.

It may be helpful to mention this limitation in the Readme for a few months, while the industry is transitioning to the updated stack.

Canato commented 2 years ago

Indeed is always two face situation, where some people wanna this update and some wanna keep the support.

We decide to update so everyone can have a version that can use. Who are not using the latest gradle and java suggested by google can use the old library versions like 3.2.2 and can even branch from it to keep the support.

Who update can get the latest with the latest updates.

Of course I'm open to have both working, just not sure how to do it X'D.

But I believe the best would be people branch 3.2.2 and create 3.2.3, 3.2.4 etc when needed. If we have people supporting a second main branch with Java 8 we can add clear instructions for it.

You are right, the README is wrong, will update on the branch i'm working #275 thanks for spotting it 🚀

stale[bot] commented 2 years ago

Let's keep this mess organised! This issue has been automatically marked as stale because it has not had recent activity. =( It will be closed if no further activity occurs. Thank you for your contributions.