Android Gradle 问题 : Caused by: groovy. lang.MissingMethodException:没有方法签名

标签 android gradle exception build version

我的项目永远不会构建。我一直遇到同样的错误。

我尝试了一天其他解决方案,但无法取得进展:/

我搜索了解决方案,发现可能和maven有关。

顺便说一句,我的项目很旧。

这里是错误消息;

enter image description here

Caused by: groovy.lang.MissingMethodException: No signature of method: build_1tiyt7a69ra5smonjfai0v39h.android() is applicable for argument types: (build_1tiyt7a69ra5smonjfai0v39h$_run_closure2) values: [build_1tiyt7a69ra5smonjfai0v39h$_run_closure2@2cca4753]
at build_1tiyt7a69ra5smonjfai0v39h.run

我的build.gradle(应用程序)文件如下。

buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url "http://dl.bintray.com/journeyapps/maven"; allowInsecureProtocol = true }
    }
}

repositories {
        google()
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
        maven { url "https://jitpack.io" }
        flatDir { dirs "libs" }
    }


android {

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
    defaultConfig {
        applicationId "com.boomset.mobile"
        minSdkVersion 21
        compileSdkVersion 30
        targetSdk 31
        versionCode 60000013
        versionName "6.1.3"

        multiDexEnabled true
    }
    dexOptions {
        maxProcessCount 2
        javaMaxHeapSize "4g"
    }
 
    buildTypes {
        debug {
            debuggable true
            buildConfigField("int", "PLATFORM", platform)
            buildConfigField "String", "API_URL", "\"${endpoint}\""
            buildConfigField "String", "API_URL_PRETEST", "\"${pretest_endpoint}\""
            buildConfigField "String", "API_URL_STAGING", "\"${staging_endpoint}\""
            applicationIdSuffix ".debug"
        }
        release {
            buildConfigField("int", "PLATFORM", platform)
            buildConfigField "String", "API_URL", "\"${endpoint}\""
            buildConfigField "String", "API_URL_PRETEST", "\"${pretest_endpoint}\""
            buildConfigField "String", "API_URL_STAGING", "\"${staging_endpoint}\""
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            //signingConfig signingConfigs.config
        }
//        lintOptions {
//            disable 'InvalidPackage'
//        }

        lintOptions {
            checkReleaseBuilds false
            // Or, if you prefer, you can continue to check for errors in release builds,
            // but continue the build even when errors are found:
            abortOnError false
        }
    }


    configurations {
        all*.exclude module: 'gson'
    }

    configurations.all {
        c -> c.resolutionStrategy.dependencySubstitution {
            all { DependencySubstitution dependency ->
                if (dependency.requested.group == 'org.bouncycastle') {
                    dependency.useTarget 'org.bouncycastle:bcprov-jdk15to18:1.69'
                }
            }
        }
    }


    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
    buildToolsVersion '29.0.3'
}

ext {
    supportLibraryVersion = '1.0.0'
    retrofitVersion = '2.4.0'
    okhttp3Version = '3.10.0'
    rxjava2Version = '2.2.1'
    butterKnifeVersion = '10.1.0'
    leakCanary = '1.5.4'
    ormlite = '4.48'
}


dependencies {

//dependencies...

}

感谢您的帮助

最佳答案

如果您最近对 proguard 进行了一些更改。 查找将 useProguard 设置为 false/true 并删除的行,因为它不再受支持

关于Android Gradle 问题 : Caused by: groovy. lang.MissingMethodException:没有方法签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70593187/

相关文章:

android - 上下文操作栏不覆盖我的工具栏

android - 旋转图像时如何避免 OutOfMemory ex?

Android:adb pull 命令不起作用/无法执行

Android Gradle Apache HttpClient 不存在?

gradle - Gradle找不到在buildscript中声明的插件

c# - 如何处理 'The controller for path '/index' 未找到或未在 asp.net mvc 中实现 IController'?

java - 创建新项目时未创建 Appcompat_v7

java - Gradle 任务依赖于一个不应该存在的文件

java - 如何处理执行许多不同背景更改的外观方法的错误?

c++ - Ogre 对异常的使用是使用它们的好方法吗?