简体   繁体   中英

what is the difference between config and release tags while generating signed apk?

I saw some tutorials of how to make release apk and after I had finished I realized some lines was added to gradle ,something like that

signingConfigs {
    config {
        keyAlias 'akeyalias'
        keyPassword '*******'
        storeFile file("apath")
        storePassword '********'
    }
  } 

but while I was searching on the internet or some questions I see that

 signingConfigs {
    release {
       keyAlias 'akeyalias'
        keyPassword '*******'
        storeFile file("apath")
        storePassword '********'
    }
  }

so what is the difference and is it ok to use config to generate release apk?

If you have an application which is being developed by a several developers you will probably want to remove the signing key from your build.gradle file and put it into a separate properties file--for example for safe keeping you would create a separate properties file and add the signing keys like this:

android {
    signingConfigs {
        config {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    ...
  }


Directly from Android Docs:

When you create a signing configuration, Android Studio adds your signing information in plain text to the module's build.gradle files. If you are working with a team or open-sourcing your code, you should move this sensitive information out of the build files so it is not easily accessible to others. To do this, you should create a separate properties file to store secure information and refer to that file in your build files...


There is much more to actually moving the signing configuration to a separate file so see this section Remove signing information from your build files


If you are solely in control of your application or you trust your team (not advisable) you can leave the signing key in the build.gradle and use the other form like:

signingConfigs {
        release {
            storeFile file("my-release-key.jks")
            storePassword "password"
            keyAlias "my-alias"
            keyPassword "password"
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM