I added the signing process in the app gradle file (this process is executed only for release build) instead of using Android signing task in my azure pipeline. I have added a keystore.properties in my project like this and added the my "dev" keystore values as they replaced by my pipeline variables and secure file anyway!
keyPassword=****
keyAlias=****
storeFile=/** jks path **/
And the app build.gradle file contains this signing process for release build variant using my properties file :
// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")
// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()
// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
....
android {
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
compileSdkVersion 30
defaultConfig {
//.....
}
buildTypes {
release {
//+ specify the signing config
signingConfig signingConfigs.release
}
And my pipeline YAML script is: I added this tasks before Gradle@2, copy files and publish artifact tasks in script,
steps:
#get the keyStore file encoded
- task: DownloadSecureFile@1
name: yourNameHere
displayName: 'Get KeyStore file'
inputs:
secureFile: 'yourKeyStore.keystore'
# rewrite keystore.properties
- script: |
printf 'storePassword=%s\nkeyPassword=%s\nkeyAlias=%s\nstoreFile=%s' $(Store.Password) $(KeyStore.Password) $(KeyStore.KeyAlias) $(yourNameHere.secureFilePath) > keystore.properties
displayName: Generate keystore.properties
But the problem is, I'm getting an error while running the pipeline in azure devops:
A problem occurred evaluating project ':app'.
path may not be null or empty string. path='null'
I think, I mentioned the wrong securefile path in my yaml file. If it is related to azure devops securefile path, please tell me path I have to use, if not what is solution to sign the app bundle without using Android signing task in pipeline and also without adding our keystore file in the repo.**