Execution failed for task ':location:compileDebugKotlin'.
构建:gradle(模块:应用程序)
ext.kotlin_version = '1.6.10'
repositories {
maven {
//url 'https://dl.google.com/dl/android/maven2',
url 'http://download.flutter.io'
}
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.android.tools.build:gradle:4.+'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
//classpath("com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0")
}
}
allprojects {
repositories {
maven {
apply plugin: 'maven'
//url 'https://dl.google.com/dl/android/maven2',
url 'http://download.flutter.io'
}
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
Run Code Online (Sandbox Code Playgroud)
构建:gradle(项目)
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
} …Run Code Online (Sandbox Code Playgroud) 我一直在寻找此错误的解决方案,但没有找到任何解决方案。我有一个 flutter 项目,在尝试构建要发布的 apk 时,我不断在 app/build.gradle 文件中收到此错误。
Could not get unknown property 'flutterRoot' for project ':app' of type org.gradle.api.Project.
Run Code Online (Sandbox Code Playgroud)
下面是我的构建 gradle 文件。
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new FileNotFoundException ("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def …Run Code Online (Sandbox Code Playgroud)