flutter - Could not apply requested plugin [id: 'org.gradle.kotlin.kotlin-dsl' - Stack Overflow

So, I am encountering an issue. I just upgraded to flutter stable version 3.27.4.In my pubspec.yaml:e

So, I am encountering an issue. I just upgraded to flutter stable version 3.27.4. In my pubspec.yaml: environment: sdk: ^3.6.0

When I try to run my app. I get the following error:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\manit\fvm\versions\stable\packages\flutter_tools\gradle\build.gradle.kts' line: 7

* What went wrong:
Could not apply requested plugin [id: '.gradle.kotlin.kotlin-dsl', version: '4.4.0'] as it does not provide a plugin with id '.gradle.kotlin.kotlin-dsl'. This is caused by an incorrect plugin implementation. Please contact the plugin author(s).

My android settings.gradle. Looks like this:

pluginManagement {
  def flutterSdkPath = {
    def properties = new Properties()
    file("local.properties").withInputStream {
      properties.load(it)
    }
    def flutterSdkPath = properties.getProperty("flutter.sdk")
    assert flutterSdkPath != null,
    "flutter.sdk not set in local.properties"
    return flutterSdkPath
  }()

  includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

  repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
  }
}

plugins {
  id "dev.flutter.flutter-plugin-loader" version "1.0.0"
  id "com.android.application" version '8.7.0' apply false
  id ".jetbrains.kotlin.android" version "2.0.20" apply false
  id "com.google.gms.google-services" version "4.4.0" apply false
}

include ":app"

While in my android/app/build.gradle. I have the following:

android {
    compileSdkVersion 35

    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_21
        targetCompatibility JavaVersion.VERSION_21
    }

    kotlinOptions {
        jvmTarget = "21"
    }

    kotlin {
        jvmToolchain(21)
    }

    java {
        toolchain {
            languageVersion = JavaLanguageVersion.of(21)
        }
    }

Could my java version be what is causing the issues ? I have been using jvm version 21 for 2 months now for my project. In the file 'C:\Users\manit\fvm\versions\stable\packages\flutter_tools\gradle\build.gradle.kts' line: 7. It looks like this: import .jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
    `java-gradle-plugin`
    groovy
    `kotlin-dsl`
    kotlin("jvm") version "1.9.20"
}

Could a mismatch in java versions be the issue ? Any help would be great.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744969785a4603899.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信