Skip to content
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

receive_sharing_intent:compileDebugKotlin #344

Open
mukesh249 opened this issue Dec 5, 2024 · 6 comments
Open

receive_sharing_intent:compileDebugKotlin #344

mukesh249 opened this issue Dec 5, 2024 · 6 comments

Comments

@mukesh249
Copy link

FAILURE: Build failed with an exception.

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

Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (21).

Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation

Thank you in advance, can you help me on it.
i'm using latest version of flutter so can't downgrade the project. anyone can help to fix the issue

@marshi
Copy link

marshi commented Dec 5, 2024

I encountered the same issue and found a workaround.

Here are the steps to resolve it:

  1. Open the "android" project in your Flutter project using Android Studio
  2. Locate the android/android[receive_sharing_intent] directory and open its build.gradle file
  3. Add the following compileOptions and kotlinOptions configurations:
android {
...
compileOptions {
    sourceCompatibility = JavaVersion.VERSION_21
    targetCompatibility = JavaVersion.VERSION_21
}
kotlinOptions {
    jvmTarget = "21"
}
}
  1. Rebuild the project.

Please note that this is a temporary workaround rather than a permanent solution.

@sashker
Copy link

sashker commented Dec 13, 2024

I am pretty sure that this problem is related to Gradle 8.1+ in Flutter 3.27... So the project has to be migrated to the new Version.

@tschiekdev
Copy link

Is something happening here?

@Glutamat42
Copy link

i had issues with the jvmTarget. latest version on github fixed it for me. Not exactly sure if it was the same issue. You might try using this in your pubspec.yaml

  receive_sharing_intent:
    git:
      url: https://github.com/KasemJaffer/receive_sharing_intent
      ref: 2cea396843cd3ab1b5ec4334be4233864637874e

@maelchiotti
Copy link

maelchiotti commented Dec 31, 2024

Fixed by #333

@MilleBii
Copy link

Pubspec

receive_sharing_intent: #requires a specific commit from git
git:
url: https://github.com/KasemJaffer/receive_sharing_intent
ref: 2cea396

build.gradle

android {
namespace =
compileSdk = 34 // Explicitly set instead of using flutter.compileSdkVersion

defaultConfig {
    minSdk = 27
    targetSdk = 34
  ...
kotlin {
    jvmToolchain(17) // Use the desired Java version
}
    // Override the plugin's minSdkVersion
configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-annotations:28.0.0'
        force 'com.android.support:support-compat:28.0.0'
    }

./gradlew build

receive_sharing_intent-2cea396843cd3ab1b5ec4334be4233864637874e\android\src\main\kotlin\com\kasem\receive_sharing_intent\ReceiveSharingIntentPlugin.kt:160: Error: Call requires API level 27 (current min is 19): android.media.MediaMetadataRetriever#getScaledFrameAtTime [NewApi]
val bitmap = retriever.getScaledFrameAtTime(-1, OPTION_CLOSEST_SYNC, 360, 360)

                             ~~~~~~~~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants