Google Play Console Service Account
This guide explains how to create a Google Play Console service account for automated deployment with MobileCtl.
One Service Account for Firebase & Play Console
Good news! You can use the same service account for both Firebase App Distribution and Google Play Console. No need to create separate credentials - just set up proper permissions for both services.
Overview
A Google Play Console service account enables:
- Upload APK/AAB files programmatically
- Manage releases on Play Console
- Update app metadata
- Deploy to different release tracks (internal, alpha, beta, production)
Prerequisites
Before you begin, make sure you have:
- Google Play Console access with Admin or Account Owner permissions
- Google Cloud Platform access (free to create)
- An app registered in Google Play Console (can be in draft state)
Step 1: Create Google Cloud Project
1.1 Navigate to Google Cloud Platform
- Go to Google Cloud Console
- Sign in with your Google account
1.2 Create New Project (or Use Existing)
Option A: Create New Project
- Click the project dropdown at the top
- Click New Project
- Enter project name (e.g.,
my-app-deployment) - Click Create
Option B: Use Existing Firebase Project (Recommended)
If you already have a Firebase project:
- Click the project dropdown at the top
- Select your existing Firebase project
- This allows you to use one service account for both Firebase and Play Console!
Use Existing Firebase Project
If you're already using Firebase, select the same Google Cloud project. This way, you can use one service account for both Firebase App Distribution and Play Console deployment!
Step 2: Enable Google Play Android Developer API
Critical Step - Don't Skip!
You must enable the Google Play Android Developer API. Skipping this step will result in your JSON key being rejected because it won't have access to the Play Console API.
- With your project selected, go to APIs & Services → Library
- In the search box, type:
Google Play Android Developer API - Click on Google Play Android Developer API
- Click ENABLE
- Wait for it to enable (takes a few seconds)
You should see "API enabled" confirmation.
Step 3: Create Service Account
3.1 Navigate to Credentials
- Go to APIs & Services → Credentials
- Click Create Credentials at the top
- Select Service account
3.2 Create Service Account
On the Create service account page:
Fill in the details:
- Service account name:
mobilectl-deploy(orandroid-deployment) - Service account ID: Auto-generated (e.g.,
mobilectl-deploy@your-project.iam.gserviceaccount.com) - Description:
Service account for automated Android app deployment
- Service account name:
Click CREATE AND CONTINUE
3.3 Grant Editor Role
On the Grant this service account access to project step:
- Click Select a role dropdown
- Search for
Editor - Select Editor role
- Click CONTINUE
Why Editor Role?
The Editor role provides the necessary permissions for both Play Console API access and Firebase (if you're using it). This is the recommended role for deployment automation.
- Skip the optional step "Grant users access to this service account"
- Click DONE
Step 4: Download JSON Key
4.1 Find Your Service Account
- You'll be returned to the Credentials page
- Scroll down to Service Accounts section
- Find the service account you just created
4.2 Manage Keys
- Click on the Actions menu (three vertical dots) for your service account
- Click Manage keys
4.3 Create and Download Key
- Click ADD KEY
- Select Create new key
- Choose JSON format
- Click CREATE
The JSON key file will automatically download to your computer.
Download Only Once!
You can only download this key file once! Store it securely. If lost, you'll need to create a new key.
4.4 Store the Key Securely
# Create credentials directory
mkdir -p credentials
# Rename for clarity
# If using for BOTH Firebase and Play Console:
mv ~/Downloads/your-project-*.json credentials/google-service-account.json
# Or if using for Play Console only:
mv ~/Downloads/your-project-*.json credentials/play-console-service-account.json
# Set restrictive permissions
chmod 600 credentials/google-service-account.jsonNaming Recommendation
If using for both Firebase and Play Console, name it generically:
google-service-account.json(recommended)android-deployment-sa.jsonfirebase-play-console-sa.json
Step 5: Grant Play Console Permissions
Now you need to invite this service account in Google Play Console.
5.1 Navigate to Users and Permissions
- Go to Google Play Console
- Select your app (or any app if setting up for all apps)
- In the left sidebar, click Users and permissions
- Click Invite new users button
Alternative Path
Some accounts may have this at the account level:
- Click the settings gear icon
- Select Users and permissions
- Click Invite new users
5.2 Add Service Account Email
In the Email address field, enter the service account email
- Find this in the JSON file: look for
client_email - Format:
mobilectl-deploy@your-project.iam.gserviceaccount.com
- Find this in the JSON file: look for
Don't send a notification email (it's a service account, not a real person)
5.3 Configure Permissions
In the permissions section:
App Permissions:
- Select the apps this service account can access:
- All current and future apps (recommended)
- Or select specific apps
Account Permissions:
Recommended Permissions
Select these permissions for full deployment automation:
Required for Releases:
- ✅ View app information (read only)
- ✅ Manage production releases
- ✅ Manage testing track releases
Store Presence (Recommended):
- ✅ Edit store listing, pricing & distribution
- ✅ Manage store presence
App Access (Read-only):
- ✅ View app information (read only)
Financial Data (Optional):
- Only if you need to access financial reports
Minimum Required Permissions
At minimum, you need:
- View app information (read only)
- Manage testing track releases (for internal/alpha/beta)
- Manage production releases (for production track)
5.4 Invite User
- Review the permissions
- Click Invite user button
- Click Send invite in the confirmation dialog
Permission Propagation
It may take a few minutes for permissions to fully propagate. If deployment fails immediately after setup, wait 2-3 minutes and try again.
Step 6: Configure MobileCtl
6.1 For Play Console Only
# mobileops.yaml
deploy:
android:
play_console:
enabled: true
service_account: credentials/google-service-account.json
package_name: com.example.yourapp
track: internal # Options: internal, alpha, beta, production6.2 For Both Firebase and Play Console (Recommended!)
Use the same service account for both destinations:
# mobileops.yaml
deploy:
android:
# Use same service account for both!
firebase:
enabled: true
service_account: credentials/google-service-account.json
test_groups:
- qa-team
- internal
play_console:
enabled: true
service_account: credentials/google-service-account.json # Same file!
package_name: com.example.yourapp
track: internalOne Credential, Multiple Destinations
If you created the service account in a Firebase project and granted it Editor role, you can use the same JSON file for both Firebase App Distribution and Play Console deployment!
6.3 Test the Setup
# Build your app
mobilectl build android
# Test Play Console upload
mobilectl deploy --platform android --destination play-console
# If you configured Firebase too:
mobilectl deploy --platform android --destination firebase
# Deploy to both at once:
mobilectl deploy --platform android --destination play-console,firebaseTrack Options Explained
Google Play supports different release tracks:
| Track | Description | Review Time | Tester Limit |
|---|---|---|---|
| internal | Internal testing, no review | Instant | 100 testers |
| alpha | Closed testing | Hours | Unlimited |
| beta | Open or closed testing | Hours | Unlimited |
| production | Public release | 1-7 days | Everyone |
Start with Internal
Use internal track for initial testing - it's instant and perfect for CI/CD pipelines.
Verification
Check File Format
# Verify JSON is valid
cat credentials/google-service-account.json | jq .
# Should contain:
{
"type": "service_account",
"project_id": "your-project-id",
"private_key_id": "...",
"private_key": "-----BEGIN PRIVATE KEY-----\n...",
"client_email": "mobilectl-deploy@your-project.iam.gserviceaccount.com",
...
}Test Upload
# Dry run (doesn't actually upload)
mobilectl deploy --platform android --destination play-console --dry-run
# Real upload
mobilectl deploy --platform android --destination play-consoleCheck Google Play Console → Release → Testing → Internal testing to see your build!
Troubleshooting
Error: "The current user has insufficient permissions"
Cause: Service account doesn't have required permissions in Play Console
Solution:
- Go to Play Console → Users and permissions
- Find your service account email
- Click on it to edit permissions
- Ensure it has at least:
- View app information (read only)
- Manage testing track releases
- Manage production releases
- Save changes
- Wait 2-3 minutes for changes to propagate
Error: "403 Forbidden" or "The API is not enabled"
Cause: Google Play Android Developer API is not enabled
Solution:
- Go to Google Cloud Console
- Select your project
- Go to APIs & Services → Library
- Search for
Google Play Android Developer API - Click ENABLE
- Wait a few minutes and try again
Error: "The resource could not be found" or "Package not found"
Cause: Package name mismatch or app not properly registered
Solution:
- Verify
package_nameinmobileops.yamlmatches exactly:- The package name in Google Play Console
- Your app's
applicationIdinbuild.gradle
- Ensure the app is created in Play Console (even if not published)
- Check that you granted the service account access to this specific app
Error: "Invalid JSON key" or "Could not load credentials"
Cause: JSON file corrupted or malformed
Solution:
- Validate JSON:
cat credentials/google-service-account.json | jq . - Check file permissions:
ls -l credentials/google-service-account.json(should be-rw-------) - Verify the file isn't empty:
wc -l credentials/google-service-account.json - If corrupted, re-download from Google Cloud Console
Service Account Not Found in Play Console
Cause: Email address typo or service account not created
Solution:
- Check the
client_emailin your JSON file - Copy it exactly (don't type it manually)
- Ensure the service account exists in GCP Console
- Verify you're in the correct Google Cloud project
Error: "Permission denied" when deploying
Cause: Recent permission changes haven't propagated
Solution:
- Wait 2-5 minutes after granting permissions
- Verify permissions are correctly set in Play Console
- Try re-downloading the JSON key
- Check the service account hasn't been disabled
Security Best Practices
1. Never Commit Credentials to Git
# .gitignore
credentials/
*.json
!package.json
!tsconfig.json
**/google-services.json2. Use Environment-Specific Service Accounts
# Production
deploy:
android:
play_console:
service_account: credentials/google-sa-production.json
# Staging
deploy:
android:
play_console:
service_account: credentials/google-sa-staging.json3. Rotate Keys Regularly
# Every 90-180 days:
# 1. Create new key in GCP Console
# 2. Update mobilectl config
# 3. Test deployment
# 4. Delete old key in GCP Console4. Monitor Service Account Activity
- Go to Google Cloud Console
- Navigate to IAM & Admin → Service Accounts
- Click your service account
- Review activity logs
- Monitor for unexpected usage patterns
5. Principle of Least Privilege
Only grant permissions actually needed:
✓ For internal testing: Manage testing track releases
✓ For production: Manage production releases
✗ Don't grant more permissions than necessaryCI/CD Integration
GitHub Actions
# .github/workflows/deploy-android.yml
name: Deploy Android to Play Console
on:
push:
tags:
- 'v*'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build Android App
run: ./gradlew assembleRelease
- name: Deploy to Play Console
env:
GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }}
run: |
echo "$GOOGLE_SERVICE_ACCOUNT" > /tmp/google-sa.json
mobilectl deploy --platform android --destination play-consoleSetup GitHub Secrets:
- Go to repository Settings → Secrets and variables → Actions
- Click New repository secret
- Name:
GOOGLE_SERVICE_ACCOUNT_JSON - Value: Paste the entire contents of your
google-service-account.json - Click Add secret
GitLab CI
# .gitlab-ci.yml
deploy_android:
stage: deploy
image: openjdk:17
script:
- echo "$GOOGLE_SERVICE_ACCOUNT_JSON" > /tmp/google-sa.json
- mobilectl deploy --platform android --destination play-console
only:
- tags
variables:
GIT_STRATEGY: cloneSetup GitLab Variables:
- Go to Settings → CI/CD → Variables
- Click Add variable
- Key:
GOOGLE_SERVICE_ACCOUNT_JSON - Value: Paste JSON file contents
- Type: File (recommended) or Variable
- ✅ Protect variable
- ✅ Mask variable
- Click Add variable
Using Same Service Account for Multiple Apps
Same Team, Multiple Apps
One service account can manage all your apps:
# App 1 config
deploy:
android:
play_console:
service_account: credentials/google-service-account.json
package_name: com.example.app1
# App 2 config
deploy:
android:
play_console:
service_account: credentials/google-service-account.json # Same file!
package_name: com.example.app2Just make sure to grant the service account access to all apps in Play Console.
Adding Firebase to Existing Service Account
If you created this service account for Play Console and want to use it for Firebase too:
- Go to Google Cloud Console
- Select your project
- Go to IAM & Admin → IAM
- Find your service account
- Click the edit icon (pencil)
- Click ADD ANOTHER ROLE
- Add: Firebase App Distribution Admin
- Click Save
- Now you can use the same JSON file for both!
Related Documentation
- Firebase Service Account - Use same service account for Firebase!
- Deploy Command - Deployment options and strategies
- Setup Wizard - Automated credential configuration
- CI/CD Integration - Complete automation examples
- Configuration Reference - All deployment config options
Useful Links
- Google Play Console
- Google Cloud Console
- Google Play Developer API
- Google Play Android Developer API
- Service Account Documentation
Quick Reference
TL;DR:
- Create Google Cloud project (or use existing Firebase project)
- Enable Google Play Android Developer API ⚠️ (critical!)
- Go to Credentials → Create Credentials → Service account
- Name it and assign Editor role
- Download JSON key
- Go to Play Console → Users and permissions → Invite new users
- Add service account email with appropriate permissions
- Add to
mobileops.yaml:service_account: credentials/google-sa.json - Test:
mobilectl deploy --platform android --destination play-console
For Firebase + Play Console (same service account):
- Use existing Firebase project in step 1
- Same service account JSON works for both!
- Deploy to both:
mobilectl deploy --platform android --destination firebase,play-console
One service account. Two destinations. Zero hassle. ✨