could not find method signingConfig()

Viewed 1041

i was trying to make release and debug variants of my app so i made some changes to build.gradle of my project but when i tried to sync gradle file there is an error occured.

here is my gradle file code

    release{
        storeFile file("C:\\Users\\jitendra\\AndroidStudioProjects\\NewsApp\\config\\NewsAppKey.jks");
        storePassword("Password123");
        keyAlias("NewsAppKey");
        keyPassword("Password123");
    }
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
        signingConfig signingConfig.release
    }
    debug{

        debuggable true
        applicationIdSuffix ".debug"
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg','proguard_debug.cfg'
    }
}
packagingOptions {
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
}

here is error

Error:(15, 0) Could not find method signingConfig() for arguments [build_c5ycoyx8ri4a8n6vogeddf49z$_run_closure1$_closure4@6ca2a2ce] on object of type com.android.build.gradle.AppExtension.

Open File

1 Answers

Should be signingConfig signingConfigs.release not signingConfig signingConfig.release (note the extra "s").

Also, I would suggest avoiding giving the signing config the same name as your build type, as it can confuse Gradle. I always give it a different name, even something like "scRelease" should be okay.

Related