Не удалось найти метод Properties () для аргументов [] в проекте ': app' типа org.gradle.api.Project

Я получаю эту ошибку после того, как обновил Flutter в Android Studio. Пожалуйста, помогите, я устал от обновления и понижения команды flutter doctor в Firebase Auth зависимостей не показывать ошибки, я также пытался изменить classpath, но не повезло, но при сборке я всегда получаю эту ошибку

FAILURE: Build failed with an exception.
[   +2 ms] * Where:
[        ] Build file 'C:UsersCorsairDesktopFlutter_1_2outdoor_1_2androidappuild.gradle' line: 2
[        ] * What went wrong:
[        ] A problem occurred evaluating project ':app'.
[        ] > Could not find method Properties() for arguments [] on project ':app' of type org.gradle.api.Project.
[        ] * Try:
[        ] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[        ] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 1s
[ +345 ms] Running Gradle task 'assembleDebug'... (completed in 2.4s)
[   +8 ms] "flutter run" took 3,413ms.
Gradle task assembleDebug failed with exit code 1

Это мое приложение / build.gradle


def localProperties =  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  GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = Ƈ'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = Ƈ.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.outdoor_1_2"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    classpath 'com.google.gms:google-services:4.2.0'
}

apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

это мой build.gradle

buildscript {
    ext.kotlin_version = Ƈ.3.50'
    repositories {
        jcenter()
        google()
        maven { url 'https://maven.fabric.io/public' }

    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // Add the google services classpath
        classpath 'com.google.gms:google-services:4.3.0'
        // Add fabric classpath
        classpath 'io.fabric.tools:gradle:1.26.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

это мои настройки

include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

def plugins =  new Properties()
def pluginsFile =  new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}

plugins.each { name, path ->
    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
    include ":$name"
    project(":$name").projectDir = pluginDirectory
}

Всего 1 ответ


Изменить это:

def localProperties =  Properties()

в это:

def localProperties =  new Properties()