Home > Blockchain >  Signing an Android app with a single .jks file between multiple developers
Signing an Android app with a single .jks file between multiple developers

Time:12-06

Hello android community,

We have an android team with 6 developers. When we create an .aab release file, we must share the .jks file among ourselves. And in the build.gradle file, we always need to change the path to the .jks file (due to different operating systems, different folder that has the .jks file). My question is is there any way to write some gradle script to only use one path for a .jks file? Or do you know other ways to do it?

Of course, we can put our .jks file in our project folder and not worry about the path. But we don't want to put .jks in the project folder for security reasons. Thanks in advance

CodePudding user response:

use environment variables to specify the path to the .jks file. This way, each developer on your team can set their own environment variable with the path to their own .jks file, and the build.gradle file can use the environment variable to specify the path to the .jks file. For example:

android {
    signingConfigs {
        release {
            storeFile file(System.getenv('JKS_FILE_PATH'))
        }
    }
}

In this case, each developer on your team would need to set the JKS_FILE_PATH environment variable on their own machine to the path to their .jks file. Then, when creating a release build, Gradle will automatically use the .jks file at the specified path for signing the release file.

android {
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}
  • Related