我是Android Studio和Flutter的新手。我最近想尝试Flutter,因此在Android Studio中安装了该插件。我的Flutter代码没有错误,但是gradle失败了。
应用程序级别构建gradle:
def localProperties = new Properties() //here, Properties gets highlighted as error
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 GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") //here,GradleException gets highlighted as error
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own …Run Code Online (Sandbox Code Playgroud)