flutter_image_cropper icon indicating copy to clipboard operation
flutter_image_cropper copied to clipboard

Kotlin Version Mismatch with image_cropper Plugin (v7.1.0)

Open tfozo opened this issue 1 year ago • 2 comments

I'm encountering a Kotlin version mismatch when using the image_cropper plugin (v7.1.0) in my Flutter project. My project is configured to use Kotlin 1.9.0, but the image_cropper plugin appears to be built with Kotlin 1.7.1, causing compilation errors.

Steps to Reproduce:

  1. Create a Flutter project.
  2. Add the image_cropper plugin (v7.1.0) to your pubspec.yaml file.
  3. Configure your Android project to use Kotlin 1.9.0 (in android/build.gradle).
  4. Attempt to build the Android project.

Expected Behavior:

The project should build successfully without Kotlin version conflicts.

Actual Behavior:

The build fails with errors indicating a Kotlinversion mismatch, such as:

Running Gradle task 'assembleDebug'... Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\Users\nova\AppData\Local\Pub\Cache\hosted\pub.dev\image_cropper-7.1.0\android\src\main\java\vn\hunghd\flutter\plugins\imagecropper\ImageCropperDelegate.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. e: C:/Users/nova/.gradle/caches/transforms-3/3abfc947dc4dd091590e67daa7b1ad6f/transformed/jetified-kotlin-stdlib-common-1.9.0.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: C:/Users/nova/.gradle/caches/transforms-3/66891dade60b1d30c535ec5e31f371cf/transformed/jetified-kotlin-stdlib-1.9.0.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: C:/Users/nova/.gradle/caches/transforms-3/66891dade60b1d30c535ec5e31f371cf/transformed/jetified-kotlin-stdlib-1.9.0.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: C:/Users/nova/.gradle/caches/transforms-3/66891dade60b1d30c535ec5e31f371cf/transformed/jetified-kotlin-stdlib-1.9.0.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.

FAILURE: Build failed with an exception.

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

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more details

  • 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 32s

┌─ Flutter Fix │ [!] Your project requires a newer version of the Kotlin Gradle plugin. │ │ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │ │ update C:\Users\nova\Desktop\fellowsheep\android\build.gradle: │ │ ext.kotlin_version = '' │ └───────────────────────────────────────────┘ Error: Gradle task assembleDebug failed with exit code 1

I just updated to the new flutter version and now I'm in hell

Environment:

  • Flutter version: (Paste your Flutter version here)
  • Kotlin version: 1.9.0
  • image_cropper version: 7.1.0
  • Android Studio version: (Paste your Android Studio version here)

Possible Solutions:

  • Release a new version of the image_cropper plugin that supports Kotlin 1.9.0.
  • Provide guidance on how to resolve the conflict for users who need to use Kotlin 1.9.0.

Let me know if you need any further information to investigate this issue.

tfozo avatar Jul 02 '24 01:07 tfozo

Note: C:\Users\nova\AppData\Local\Pub\Cache\hosted\pub.dev\image_cropper-7.1.0\android\src\main\java\vn\hunghd\flutter\plugins\imagecropper\ImageCropperDelegate.java uses or overrides a deprecated API.

tfozo avatar Jul 03 '24 02:07 tfozo

subprojects { tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { kotlinOptions.jvmTarget = "1.8" } }

Try this I used this and it solved the bug for mine

pndychrg avatar Jan 15 '25 07:01 pndychrg