应用插件请求时发生异常[id: 'dev.flutter.flutter-plugin-loader', version: '1.0.0']

问题描述 投票:0回答:1

我正在尝试为我的 flutter 应用程序构建 Apk,但出现以下错误

  • 出了什么问题: 应用插件请求时发生异常 [id: 'dev.flutter.flutter-plugin-loader', version: '1.0.0']

无法应用插件“dev.flutter.flutter-plugin-loader”。 无法加载脚本 'C:\src lutter\packages lutter_tools\gradle\src\main\groovy 的已编译类 来自缓存的 ative_plugin_loader.groovy'。

  • 尝试:

使用 --stacktrace 选项运行以获取堆栈跟踪。 使用 --info 或 --debug 选项运行以获得更多日志输出。 使用 --scan 运行以获得完整的见解。

这是我的设置.gradle

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
    }
    settings.ext.flutterSdkPath = flutterSdkPath()

    includeBuild("${settings.ext.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 "7.4.0" apply false //7.3.0
    id "org.jetbrains.kotlin.android" version "1.8.10" apply false
    id "com.google.gms.google-services" version "4.3.15" apply false
}

include ":app"`
`


flutter flutter-dependencies
1个回答
0
投票

尝试更改一行:

 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 "7.4.0" apply false //7.3.0
    id "org.jetbrains.kotlin.android" version "1.8.10" apply false
    id "com.google.gms.google-services" version "4.3.15" apply false
}

include ":app"`
© www.soinside.com 2019 - 2024. All rights reserved.