简体   繁体   English

Flutter 无法在 org.gradle.Z8A5DA52ED1264741A83 类型的项目 ':app' 上找到 arguments [] 的方法 Properties()

[英]Flutter Could not find method Properties() for arguments [] on project ':app' of type org.gradle.api.Project

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 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 = '44'
}

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

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

def keystoreProperties = Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}


android {
    compileSdkVersion 29

    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.credfinance.credfinance"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 44
        versionName '4.4'
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
   }
   buildTypes {
       release {
           signingConfig signingConfigs.release
       }
   }
}

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'
}

OUT PUT:输出:

mac@Macs-MacBook-Air credapp % flutter run Launching lib/main.dart on SM N950U in debug mode... mac@Macs-MacBook-Air credapp % flutter run 在调试模式下在 SM N950U 上启动 lib/main.dart...

FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。

  • Where:在哪里:
    Build file '/Users/mac/Documents/Flutter_Project/credapp/android/app/build.gradle' line: 28构建文件'/Users/mac/Documents/Flutter_Project/credapp/android/app/build.gradle' 行:28

  • What went wrong:什么地方出了错:
    A problem occurred evaluating project ':app'.评估项目 ':app' 时出现问题。

    Could not find method Properties() for arguments [] on project ':app' of type org.gradle.api.Project.在 org.gradle.api.Project 类型的项目 ':app' 上找不到 arguments [] 的方法 Properties()。

  • Try:尝试:
    Run with --stacktrace option to get the stack trace.使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.使用 --info 或 --debug 选项运行以获得更多日志 output。 Run with --scan to get full insights.运行 --scan 以获得完整的见解。

  • Get more help at https://help.gradle.orghttps://help.gradle.org获得更多帮助

BUILD FAILED in 0s 0 秒内构建失败
Running Gradle task 'assembleDebug'...运行 Gradle 任务“assembleDebug”...
Running Gradle task 'assembleDebug'... Done 2.8s Exception: Gradle task assembleDebug failed with exit code 1 mac@Macs-MacBook-Air credapp %运行 Gradle 任务“assembleDebug”...完成 2.8 秒异常:Gradle 任务 assembleDebug 失败,退出代码为 1 mac@Macs-MacBook-Air credapp %

add 'new' keyword wherever its throwing the problem.在引发问题的任何地方添加“新”关键字。

For me为了我

if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(  FileInputStream(keystorePropertiesFile))} 

was throwing error抛出错误

if (keystorePropertiesFile.exists()) {
    keystoreProperties.load( new FileInputStream(keystorePropertiesFile))}

saved the day挽救了一天

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法为 org.gradle.api.Project 类型的项目“:app”的参数找到方法 androidTestCompile() - Could not find method androidTestCompile() for arguments on project ':app' of type org.gradle.api.Project 无法为 org.gradle.api.Project 类型的项目“:app”的参数找到方法 buildTypes() - Could not find method buildTypes() for arguments on project ':app' of type org.gradle.api.Project 在 org.gradle.api.Project 类型的项目“:app”上找不到 arguments 的方法 dataBinding() - Could not find method dataBinding() for arguments on project ':app' of type org.gradle.api.Project 找不到参数 org.gradle.api.Project 的方法 android() - Could not find method android() for arguments org.gradle.api.Project 无法为参数org.gradle.api.Project找到方法android() - Could not find method android() for arguments org.gradle.api.Project 在类型为org.gradle.api.Project的根项目'..'上找不到参数[build ..]的方法android() - Could not find method android() for arguments [build..] on root project '..' of type org.gradle.api.Project 错误:无法在 org.gradle.api.Project 类型的根项目上找到 arguments 的方法 install() - Error: Could not find method install() for arguments on root project of type org.gradle.api.Project 如何处理“无法在项目中找到方法android()'的错误:org.gradle.api.Project类型的app'” - How to handle error of “Could not find method android() on project ':app' of type org.gradle.api.Project” 错误:(16,0)找不到类型为org.gradle.api.Project的根项目'delta-bartalk'上的参数的方法android() - Error:(16, 0) Could not find method android() for arguments on root project 'delta-bartalk' of type org.gradle.api.Project 在 org.gradle.api.Project 类型的根项目“xyz”上找不到 arguments [before_plugins_] 的方法 android() - Could not find method android() for arguments [before_plugins_] on root project 'xyz' of type org.gradle.api.Project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM