'PEM error when Im trying to deploy an app to Google Play through Azure DevOps

When im trying to deploy my app bundle using the Google Play - Release Bundle task in Azure DevOps, I get the following error:

Azure DevOps Hosted Agent output

##[section]Starting: Release D:\a\r1\a/_CI Workout Pipeline to Google Play Store
==============================================================================
Task         : Google Play - Release Bundle
Description  : Release an app bundle to the Google Play Store
Version      : 3.192.0
Author       : Microsoft Corporation
Help         : ms-resource:loc.helpMarkDown
==============================================================================
Found main bundle to upload: D:/a/r1/a/_CI Workout Pipeline (version code %s)
##[error]Error: error:0909006C:PEM routines:get_name:no start line
##[section]Finishing: Release D:\a\r1\a/_CI Workout Pipeline to Google Play Store

I have setup an service account in the Google Play Console, but I do not see anywhere to look for a PEM starting line.

View of the Service account in Google Play Console

Can you guys help me out?



Solution 1:[1]

I had the same problem trying to deploy an android app in Azure DevOps. Private key in a Google Play service connection was empty in my case. Ensure you have created a private key and added the key to a service connection in Azure DevOps.

Solution 2:[2]

Certificate/secret is downloaded when you 'invite' a user to your play console.

To do this (if you haven't already)

  • go to Play Console
  • go to API Access under Setup (if you're in a App, go to 'all apps' first)
  • Clink on 'create new service account'
  • This shows a dialog with instructions on how to create service accounts in Google Cloud Console (yes, excellent UX)
  • Once you created the service account in Google Cloud, go to that user and in to 'KEYS' and Add a new key
  • select JSON as the format
  • this downloads a JSON file with the key and some other information
  • Store this securely and take note of the private key in it.
  • Navigate back to play console, click done and add permissions to the new account
  • In Devop connection, enter the private key string, WITHOUT escaping JSON
    • DO NOT escape \n in the key.

Example input to the devops task will look like below

----BEGIN PRIVATE KEY-----\nMIIEvA...rnA==\n-----END PRIVATE KEY-----\n

Note that you should only exclude the quotation marks and keep the JSON encoding, including the last \n after -----END PRIVATE KEY-----.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Evgeny Valavin
Solution 2 Madushan