我在尝试在 flutter 中构建 apk 时遇到了这个问题。 [运行时的终端
flutter build apk
]
(https://i.sstatic.net/cWDAhnIg.png)
也出现此错误,我找到了其他解决方案,但它们似乎适用于旧版本。 无法解析“属性” 设置.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
}()
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.3.1" apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply true
}
include ":app"
Android/build.gradle
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
感谢您的帮助!
问题出在你的
settings.gradle
。当在插件块中注册插件时,不应该应用org.jetbrains.kotlin.android
。换成apply false
就可以了。
应用插件应该在内部完成
app/build.gradle