user15322469
user15322469

Reputation: 909

How should I set the build.gradle when building the app?

I am trying to build the app using the following command.

/android
gradlew assembleRelease

However, I am wondering if I need to remove the debug of signingConfigs and debug of buildTypes when in release mode or not?

this is my code

(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
                        }
                    }

                    debug {
                        storeFile file('debug.keystore')
                        storePassword 'android'
                        keyAlias 'androiddebugkey'
                        keyPassword 'android'
                    }
                }
                buildTypes {
                    debug {
                        signingConfig signingConfigs.debug
                    }
                    release {
                        // Caution! In production, you need to generate your own keystore file.
                        // see https://reactnative.dev/docs/signed-apk-android.
                        
                            signingConfig signingConfigs.release
                        minifyEnabled enableProguardInReleaseBuilds
                        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
                    
                    }
                }

Upvotes: 0

Views: 132

Answers (1)

Vignesh V Pai
Vignesh V Pai

Reputation: 819

No need. When building for release mode, gradle will automatically select the configs mentioned in the release section. What you specify as the configuration for release mode is important.

Upvotes: 1

Related Questions