【问题标题】:A problem occurred evaluating project ':app'. > No signature of method: build_3p评估项目 \':app\' 时出现问题。 > 没有方法签名:build_3p
【发布时间】:2022-08-09 05:33:13
【问题描述】:

运行 flutter build appbundle 命令时会显示此错误:

  • 在哪里: 构建文件 \'C:\\Projetos\\Vai para o GitHub\\devstravel\\android\\app\\build.gradle\' 行:38

    • 出了什么问题: 评估项目 \':app\' 时出现问题。

    没有方法签名:build_3p7kb4yalue4j0dkob18nu1yo.android() 适用于参数类型:(build_3p7kb4yalue4j0dkob18nu1yo$_run_closure2) 值:[build_3p7kb4yalu4j0dkob18nu1yo$_run_closure2@2d50add8]

    • 尝试:

    使用 --stacktrace 选项运行以获取堆栈跟踪。 使用 --info 或 --debug 选项运行以获得更多日志输出。 运行 --scan 以获得完整的见解。


I don\'t understand why this is wrong, I\'m uploading my build.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 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 = \'1\'
}

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

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


def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file(\'key.properties\')

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



android {
    compileSdkVersion flutter.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = \'1.8\'
    }

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId \"com.junior.devstravel\"
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs{
        release{
            keyAlias keystoreProperties[\'keyAlias\']
            keyPassword keystoreProperties [\'keyPassword\']
            storeFile keystoreProperties [\'storeFile\'] ? file(keystoreProperties[\'storeFile\']) : null
            sotePassword keystoreProperties [\'storePassword\']
        }
    }

    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.release
        }
    }
}

flutter {
    source \'../..\'
}

dependencies {
    implementation \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version\"
}
  • 通常,如果您的应用程序在此错误之前运行良好,请检查您必须进行哪些新更改并逐行注释新更改并测试它是否构建。希望这应该有效,但发布完整的 build.gradle 文件,包括指向文件错误开始位置的指针。
  • 我也有同样的问题。我通过禁用proguard来解决它。请参阅以下文档。 github.com/flutter/flutter/issues/92974

标签: flutter


【解决方案1】:

问题的解决方案非常简单!我输错了 storePassword

signingConfigs{
    release{
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties ['keyPassword']
        storeFile keystoreProperties ['storeFile'] ? file(keystoreProperties['storeFile']) : null
        **sotePassword** keystoreProperties ['storePassword']
    }
}

【讨论】:

    【解决方案2】:

    嗨我有类似的问题也许你也可以帮助我

    • 在哪里: 构建文件 'C:\Users\mehme\OneDrive\Masaustu\chat_app\android\app\build.gradle' 行:29

    评估项目“:app”时出现问题。

    没有方法签名:build_4bcfyw4syymz7augmelpbzhw0.android() 适用于参数类型:(build_4bcfyw4syymz7augmelpbzhw0$_run_closure2) 值:[build_4bcfyw4syymz7augmelpbzhw0$_run_closure2@7ff993b]

    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 = '1'
    }
    
    def flutterVersionName = localProperties.getProperty('flutter.versionName')
    if (flutterVersionName == null) {
        flutterVersionName = '1.0'
    }
    
    apply plugin: 'com.android.application'
    apply plugin: 'com.google.gms.google-services'
    apply plugin: 'kotlin-android'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    
    android  {
        compileSdkVersion flutter.compileSdkVersion
        ndkVersion flutter.ndkVersion
    
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    
        kotlinOptions {
            jvmTarget = '1.8'
        }
    
        sourceSets {
            main.java.srcDirs += 'src/main/kotlin'
        }
    
        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "com.example.chat_app"
            // You can update the following values to match your application needs.
            // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
            minSdkVersion 21
            targetSdkVersion flutter.targetSdkVersion
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
            multiDexEnable true
        }   
    
        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 platform('com.google.firebase:firebase-bom:30.3.1')
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    }
    

    【讨论】:

      猜你喜欢
      • 2020-08-11
      • 2021-05-23
      • 2021-06-26
      • 2020-03-24
      • 1970-01-01
      • 2022-11-10
      • 2021-04-09
      • 2023-02-13
      • 2021-10-07
      相关资源
      最近更新 更多