您正在使用 apply script 方法强制应用 Flutter 的 app_plugin_loader Gradle 插件,该方法已弃用,并将在未来版本中删除。迁移到使用声明性插件块应用 Gradle 插件:https://flutter.dev/go/flutter-gradle-plugin-apply
您正在使用 apply script 方法强制应用 Flutter 的主 Gradle 插件,该方法已弃用并将在未来版本中删除。迁移到使用声明性插件块应用 Gradle 插件:https://flutter.dev/go/flutter-gradle-plugin-apply
我想运行我的 flutter 项目
您必须更改
app-src/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
}
并改变
app-src>/android/settings.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 "{agpVersion}" apply false
id "org.jetbrains.kotlin.android" version "{kotlinVersion}" apply false
}
include ":app"