Build Android APKs using GitHub Actions without installing Android Studio locally
A complete Android project template that demonstrates how to build APK files using GitHub Actions. Perfect for developers who want to create Android apps without setting up the full Android development environment locally.
- Fork this repository
- Clone to your computer:
git clone https://github.com/wasishah33/android-apk-builder.git - Make your changes (see Customization Guide)
- Push to GitHub: GitHub Actions automatically builds your APK
- Download your APK from the Actions tab
- Git - Download here
- Text Editor - VS Code, Notepad++, or any editor
- Web Browser - Chrome, Firefox, Edge, etc.
- GitHub Account - Sign up free
- β Android Studio
- β Android SDK
- β Java/Kotlin installation
- β Gradle installation
- β Emulator setup
- β¨ Modern Material Design 3 - Beautiful, responsive UI
- π’ Click Counter - Interactive button with counter
- π Toast Notifications - Celebratory messages every 5 clicks
- π± Responsive Layout - Works on all screen sizes
- π¨ Custom Theming - Easy to customize colors and styles
- π€ Automated Builds - GitHub Actions builds APKs automatically
- π¦ Multiple APK Types - Debug and Release versions
- β‘ Fast Builds - Cached dependencies for speed
- π Build Reports - Detailed logs and error reporting
- π CI/CD Ready - Professional development workflow
- Click the "Fork" button at the top of this repository
- This creates your own copy that you can modify
- Clone your fork:
git clone https://github.com/wasishah33/android-apk-builder.git
- Click "Code" β "Download ZIP"
- Extract the files to your computer
- Create a new repository on GitHub
- Upload the files to your new repository
# Install Git
# Download from: https://git-scm.com/download/win
# Follow the installer prompts (default options are fine)
# Install VS Code (optional but recommended)
# Download from: https://code.visualstudio.com/download# Install Git (if not already installed)
brew install git
# Install VS Code (optional)
brew install --cask visual-studio-code# Ubuntu/Debian
sudo apt update
sudo apt install git
# For other distributions, use your package manager- Open terminal/command prompt in your project folder
- Initialize Git (if you downloaded ZIP):
git init git add . git commit -m "Initial Android project setup"
- Connect to GitHub:
git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git git branch -M main git push -u origin main
- Go to your GitHub repository
- Click the "Actions" tab
- You should see the workflow running automatically
- Wait for it to complete (usually 3-5 minutes)
- Navigate to your repository on GitHub
- Click the "Actions" tab
- Select the latest successful workflow run (green checkmark β )
- Scroll down to the "Artifacts" section
- Download your APK:
app-debug.apk- For testing (recommended)app-release-unsigned.apk- For distribution (needs signing)
GitHub provides direct download links for artifacts, but they expire after 90 days.
-
App Name: Edit
app/src/main/res/values/strings.xml<string name="app_name">Your App Name</string>
-
Package Name: Edit
app/build.gradleandroid { namespace 'com.yourcompany.yourapp' defaultConfig { applicationId "com.yourcompany.yourapp" } }
-
Update Folder Structure:
- Rename
app/src/main/java/com/example/sampleapp/ - To
app/src/main/java/com/yourcompany/yourapp/
- Rename
Edit app/src/main/res/values/colors.xml:
<resources>
<color name="primary_text">#FF1976D2</color> <!-- Blue -->
<color name="secondary_text">#FF666666</color> <!-- Gray -->
<color name="button_color">#FF4CAF50</color> <!-- Green -->
<color name="background_color">#FFF5F5F5</color> <!-- Light Gray -->
</resources>Edit app/src/main/res/values/strings.xml:
<resources>
<string name="app_name">My Awesome App</string>
<string name="welcome_message">Welcome to My App!</string>
<string name="click_me">Tap Here!</string>
</resources>Edit app/src/main/res/layout/activity_main.xml to change the UI structure.
Edit app/src/main/java/com/example/sampleapp/MainActivity.kt:
clickButton.setOnClickListener {
// Your custom logic here
Toast.makeText(this, "Button clicked!", Toast.LENGTH_SHORT).show()
}- Create new Kotlin file in the same package
- Create corresponding layout XML file
- Register in
AndroidManifest.xml
-
Prepare icons in these sizes:
- 48x48 (mdpi)
- 72x72 (hdpi)
- 96x96 (xhdpi)
- 144x144 (xxhdpi)
- 192x192 (xxxhdpi)
-
Replace files in
app/src/main/res/mipmap-*/ -
Update
AndroidManifest.xmlif needed
android-apk-builder/
βββ π .github/workflows/ # GitHub Actions Configuration
β βββ android-build.yml # Main build workflow
βββ π app/ # Android App Module
β βββ build.gradle # App-level build configuration
β βββ proguard-rules.pro # Code obfuscation rules
β βββ π src/main/
β βββ AndroidManifest.xml # App permissions & components
β βββ π java/com/example/sampleapp/
β β βββ MainActivity.kt # Main app logic (Kotlin)
β βββ π res/ # App resources
β βββ π layout/ # UI layouts (XML)
β βββ π values/ # Strings, colors, themes
β βββ π mipmap-*/ # App icons
β βββ π xml/ # XML configurations
βββ π gradle/wrapper/ # Gradle wrapper files
βββ build.gradle # Project-level build config
βββ gradle.properties # Gradle settings
βββ settings.gradle # Project modules
βββ gradlew # Gradle wrapper (Unix)
βββ gradlew.bat # Gradle wrapper (Windows)
βββ .gitignore # Git ignore rules
βββ README.md # This documentation
- Purpose: Defines the automated build process
- Triggers: Runs on push to main/master branch
- Actions: Sets up environment, builds APK, uploads artifacts
- Purpose: App-specific build configuration
- Contains: Dependencies, build types, SDK versions
- Modify: To add libraries or change build settings
- Purpose: Main app logic and user interface handling
- Language: Kotlin (modern Android development language)
- Modify: To add app functionality
- Purpose: Contains all app resources
- Includes: Layouts, strings, colors, images, icons
- Modify: To change app appearance and content
Add new libraries to app/build.gradle:
dependencies {
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
// Add more dependencies here
}Create different app versions by modifying app/build.gradle:
android {
buildTypes {
debug {
applicationIdSuffix ".debug"
versionNameSuffix "-DEBUG"
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
}
}
}Use GitHub secrets for sensitive data:
- Go to repository Settings β Secrets and variables β Actions
- Add your secrets (API keys, signing keys, etc.)
- Reference in workflow:
${{ secrets.YOUR_SECRET_NAME }}
- π Learning Android Development - No complex setup required
- π Rapid Prototyping - Quick app testing and iteration
- π₯ Team Collaboration - Consistent build environment
- π Educational Projects - Focus on code, not configuration
- π§ͺ Proof of Concepts - Fast validation of ideas
- π CI/CD Pipeline - Automated testing and deployment
- Simple Utility Apps - Calculators, converters, timers
- Learning Projects - Following Android tutorials
- MVP Applications - Testing app concepts quickly
- Open Source Contributions - Easy for contributors to build
- Client Demos - Quick APK generation for stakeholders
Problem: Missing or corrupted Gradle wrapper files Solution:
- Ensure
gradlewandgradlew.batfiles are present - Check file permissions:
chmod +x gradlew(Linux/Mac) - Re-download Gradle wrapper:
gradle wrapper --gradle-version 8.0
Problem: Android SDK path issues in GitHub Actions Solution: This is automatically handled by the workflow. If you see this error:
- Check
.github/workflows/android-build.ymlis present - Verify the workflow uses
actions/setup-java@v4 - Ensure
android.useAndroidX=trueis ingradle.properties
Problem: No artifacts in GitHub Actions Solutions:
- Check Build Status: Ensure the workflow completed successfully (green checkmark)
- Wait for Completion: Builds take 3-5 minutes
- Check Logs: Click on the failed step to see error details
- Artifact Expiry: Artifacts expire after 90 days
Problem: APK installation fails or app crashes Solutions:
- Use Debug APK: Always test with
app-debug.apkfirst - Check Device Compatibility: Ensure Android 5.0+ (API 21+)
- Enable Unknown Sources: Allow installation from unknown sources
- Check Logs: Use
adb logcatto see crash details
Problem: "App not installed" due to package conflicts Solutions:
- Uninstall Existing: Remove any existing app with same package name
- Change Package: Modify
applicationIdinapp/build.gradle - Use Debug Suffix: Debug builds automatically add
.debugsuffix
Problem: "No more runner minutes available" Solutions:
- Check Usage: Go to Settings β Billing β Usage
- Free Tier Limits: 2000 minutes/month for public repositories
- Optimize Builds: Use caching to reduce build time
- Private Repos: Consider upgrading to paid plan
- Enable Gradle Caching: Already configured in the workflow
- Reduce Dependencies: Only include necessary libraries
- Use Build Cache:
org.gradle.caching=true
- Parallel Builds:
org.gradle.parallel=true
- Check "Actions" tab for build duration
- Typical build time: 3-5 minutes
- First build takes longer (dependency download)
Add to MainActivity.kt:
import android.util.Log
class MainActivity : AppCompatActivity() {
companion object {
private const val TAG = "MainActivity"
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.d(TAG, "App started successfully")
// ... rest of your code
}
}- Install Debug APK: Use
app-debug.apkfor testing - Enable Developer Options: Settings β About Phone β Tap Build Number 7 times
- USB Debugging: Settings β Developer Options β USB Debugging
- View Logs: Connect to computer and run
adb logcat
- π Android Developer Guide - Official documentation
- π Android Basics Course - Free Google course
- πΊ Android Development YouTube - Official channel
- π Kotlin Documentation - Official Kotlin docs
- π Kotlin Bootcamp - Free course
- π» Kotlin Playground - Online Kotlin editor
- π GitHub Actions Documentation - Official docs
- π GitHub Learning Lab - Interactive tutorials
- π§ Android CI/CD Guide - Gradle builds
- Fork this repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- π New Sample Apps - Different app templates
- π§ Workflow Improvements - Better CI/CD features
- π Documentation - More tutorials and guides
- π Bug Fixes - Fix issues and improve stability
- π¨ UI Templates - More design examples
This project is licensed under the MIT License - see the LICENSE file for details.
- π Bug Reports: Create an Issue
- π‘ Feature Requests: Create an Issue
- π¬ Questions: Start a Discussion
- π§ Direct Contact: [email protected]
- π Star this repository if it helped you!
- π Share with other developers
- π¦ Follow on Twitter: @yourusername
- π App Signing - Automatic APK signing workflow
- π§ͺ Unit Testing - Automated testing integration
- π Code Coverage - Test coverage reports
- π¨ UI Testing - Espresso test examples
- π± Multi-Module - Complex app structure template
- π Internationalization - Multi-language support
- π¦ Google Play - Deployment automation
- v1.0 - Initial release with basic Android app and GitHub Actions
- v1.1 - Added comprehensive documentation and troubleshooting
- v1.2 - (Planned) App signing and testing integration
- π€ GitHub Actions - For providing free CI/CD for open source
- π± Android Team - For excellent documentation and tools
- π― Gradle - For powerful build automation
- π» JetBrains - For Kotlin and excellent IDEs
- π Open Source Community - For inspiration and contributions
Made with β€οΈ by developers, for developers
β Star this repository β’ π Report Bug β’ π‘ Request Feature