Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Failed Could not find method signingConfigs()

I follow in official website : https://facebook.github.io/react-native/docs/signed-apk-android.html

it said line: 128 error which is signingConfigs signingConfigs.release

in android/app/build.gradle

 signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfigs signingConfigs.release
        }
    }

in android/.gradle/gradle.properties

MYAPP_RELEASE_STORE_FILE=ezam.keystore
MYAPP_RELEASE_KEY_ALIAS=ezam
MYAPP_RELEASE_STORE_PASSWORD=*****
MYAPP_RELEASE_KEY_PASSWORD=*****
like image 650
Pansit Wattanaprasobsuk Avatar asked Aug 19 '17 14:08

Pansit Wattanaprasobsuk


4 Answers

You are adding the config to the wrong file. Add it to app level build.gradle android/app/build.gradle.

see https://github.com/Triple-T/gradle-play-publisher/issues/228#issuecomment-321557581

like image 167
bisi Avatar answered Oct 08 '22 05:10

bisi


Honestly spend 3 hours on this issue

buildTypes{
    release{
        signingConfig  // not signingConfigs without "s"
    }
}
like image 25
MinaSedrak Avatar answered Oct 08 '22 06:10

MinaSedrak


The signingConfigs element must be a child of the android element

apply plugin 'com.android.application'

android {

    // (...)

    signingConfigs {
        release {
            // (...)
        }
    }

    buildTypes {
        release {
            // (...)
            signingConfig signingConfigs.release
        }
    }
}

I experienced the same error because I didn't realise this, and made signingConfigs a top-level element.

This will give you an error:

apply plugin 'com.android.application'

signingConfigs {
    release {
        // (...)
    }
}


android {

    // (...)

    buildTypes {
        release {
            // (...)
            signingConfig signingConfigs.release
        }
    }
}
like image 36
Andrew Shepherd Avatar answered Oct 08 '22 04:10

Andrew Shepherd


In my case, I have to do

buildTypes{
    release{
        signingConfig signingConfigs.release
    }
}

instead of

buildTypes{
    release{
        signingConfig release
    }
}
like image 25
nuynait Avatar answered Oct 08 '22 06:10

nuynait