【问题标题】:Android Gradle Issue: Caused by: groovy.lang.MissingMethodException: No signature of method<已解决> Android Gradle 问题:引起:groovy.lang.MissingMethodException:没有方法签名
【发布时间】:2022-01-05 12:52:59
【问题描述】:

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

我尝试了一天的其他解决方案,但我无法进步:/

我搜索了解决方案,我意识到它可能与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 (app) 文件如下。

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

}

感谢您的帮助

已解决

我像这样在 build.gradle(项目)中更新了我的存储库块;

   repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
        maven {
            url "http://repo.commonsware.com.s3.amazonaws.com"
        }
    }

allprojectsbuildscripts 标签中

reference link

【问题讨论】:

  • 你能把你的build.gradle文件也发一下吗
  • 更喜欢自我回答而不是编辑并在您的问题中添加 naswer

标签: android gradle exception build version


【解决方案1】:

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

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 1970-01-01
  • 2022-11-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-08
  • 2020-09-15
相关资源
最近更新 更多