An open API service indexing awesome lists of open source software.

https://github.com/maheshtechnicals/android-project-generator

Generate Android Kotlin + Jetpack Compose projects from your terminal โ€” no Android Studio needed. Ideal for AI code editors like Cursor and VS Code. Auto-fetches latest AGP, Kotlin, Gradle, and Compose BOM. Includes Gradle catalog, CI/CD pipelines, tests, Material 3 theme, and adaptive icons.
https://github.com/maheshtechnicals/android-project-generator

android android-development bash ci-cd cursor gradle jetpack-compose kotlin material3 project-generator scaffold template

Last synced: about 12 hours ago
JSON representation

Generate Android Kotlin + Jetpack Compose projects from your terminal โ€” no Android Studio needed. Ideal for AI code editors like Cursor and VS Code. Auto-fetches latest AGP, Kotlin, Gradle, and Compose BOM. Includes Gradle catalog, CI/CD pipelines, tests, Material 3 theme, and adaptive icons.

Awesome Lists containing this project

README

          

# Android Project Generator ๐Ÿš€

**Create a ready-to-code Android Hello World app from your terminal โ€” no Android Studio required.**

[![GitHub release](https://img.shields.io/github/v/release/MaheshTechnicals/android-project-generator?style=flat-square)](https://github.com/MaheshTechnicals/android-project-generator/releases)
[![License](https://img.shields.io/github/license/MaheshTechnicals/android-project-generator?style=flat-square)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-linux-blue?style=flat-square)]()
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square)](CONTRIBUTING.md)

---

## ๐Ÿ“– Overview

### Why this script exists

AI code editors like Cursor and VS Code are very popular now. When you want to start a new Android project, you usually have to:

1. Open **Android Studio** (a heavy app that needs installation)
2. Click through menus to create a new project
3. Wait for Gradle sync
4. Then finally start working on your code

But many developers just want a **simple Hello World app with a proper file structure** so they can open it in their AI editor and start coding right away.

This script solves that problem. It creates a complete Android Hello World application with all the right files โ€” no Android Studio needed. You just run one command, answer a few simple questions, and you get a ready-to-code project. Open the folder in Cursor, VS Code, or any editor and start building your app.

### What it does

- Creates a **Kotlin + Jetpack Compose** project with all required files
- Auto-generates **launcher icons** (with or without ImageMagick)
- Sets up **GitHub Actions and GitLab CI/CD workflows** โ€” so even if your laptop is not powerful enough to build Android apps, you can push your code and let GitHub/GitLab build it for you
- Fetches the **latest stable versions** of AGP, Kotlin, Gradle, and Compose BOM at runtime
- Creates unit tests, UI tests, and everything needed for a professional project structure

### Who it's for

- **Developers using AI code editors** โ€” quickly generate a project and start working with AI assistance
- **Anyone with a low-end laptop** โ€” generate the project locally, build remotely via GitHub/GitLab CI
- **Android phone users** โ€” install Debian/Ubuntu (XFCE4 desktop) via Termux, set up VS Code or Cursor, run this script, and create Android projects right from your phone. Use GitHub/GitLab workflows to build
- **Anyone who wants to skip Android Studio setup** โ€” just the terminal, Java, and a few seconds

> Only a terminal, Java 21+, and a few seconds are needed.

---

## ๐Ÿงฐ Requirements

The script requires the following dependencies installed on your Linux system:

```bash
sudo apt update && sudo apt install -y openjdk-21-jdk git curl python3 imagemagick
```

| Dependency | Purpose | Required |
|------------------|--------------------------------------|----------|
| **Java 21+** | Compile Android bytecode | โœ… Yes |
| **Git** | Initialize repository | โœ… Yes |
| **curl** | Fetch latest SDK tool versions | โœ… Yes |
| **Python 3** | Parse Maven metadata XML | โœ… Yes |
| **ImageMagick** | Generate launcher & Play Store icons | โฌœ No* |

> \*ImageMagick is optional โ€” without it, the script writes minimal placeholder PNGs so the build still succeeds.

---

## ๐Ÿš€ Quick Start

```bash
# 1. Clone the generator
git clone https://github.com/MaheshTechnicals/android-project-generator.git
cd android-project-generator

# 2. Run it
bash create-android-app.sh

# 3. Follow the prompts โ€” that's it!
```

### What You'll Be Asked

| Prompt | Example |
|----------------------|----------------------------------|
| App Name | `My Awesome App` |
| Package Name | `com.example.myawesomeapp` |
| Project Directory | `my-awesome-app` |
| Min SDK | `24` (Android 7.0, default) |
| Git Remote URL | `https://github.com/you/repo.git`|
| Logo PNG Path | `/path/to/logo.png` (optional) |
| Icon Background Color| `#FF5722` (default: white) |

---

## ๐Ÿ“ฆ What Gets Generated

```
my-app/
โ”œโ”€โ”€ app/
โ”‚ โ”œโ”€โ”€ src/
โ”‚ โ”‚ โ”œโ”€โ”€ main/
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ kotlin/com/example/myapp/
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ MainActivity.kt
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ui/
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ HelloWorldScreen.kt
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ theme/
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Theme.kt
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Color.kt
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ Type.kt
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ res/
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ drawable/
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ mipmap-{mdpi,hdpi,xhdpi,xxhdpi,xxxhdpi}/
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ mipmap-anydpi-v26/
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ values/
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ layout/
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ xml/
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ AndroidManifest.xml
โ”‚ โ”‚ โ”œโ”€โ”€ test/kotlin/com/example/myapp/ExampleUnitTest.kt
โ”‚ โ”‚ โ””โ”€โ”€ androidTest/kotlin/com/example/myapp/ExampleInstrumentedTest.kt
โ”‚ โ”œโ”€โ”€ build.gradle.kts
โ”‚ โ””โ”€โ”€ proguard-rules.pro
โ”œโ”€โ”€ gradle/
โ”‚ โ”œโ”€โ”€ wrapper/
โ”‚ โ””โ”€โ”€ libs.versions.toml
โ”œโ”€โ”€ .github/workflows/android-ci.yml
โ”œโ”€โ”€ .gitlab-ci.yml
โ”œโ”€โ”€ fastlane/
โ”œโ”€โ”€ build.gradle.kts
โ”œโ”€โ”€ settings.gradle.kts
โ”œโ”€โ”€ gradle.properties
โ”œโ”€โ”€ gradlew
โ”œโ”€โ”€ local.properties.template
โ”œโ”€โ”€ .gitignore
โ””โ”€โ”€ README.md
```

---

## ๐Ÿ— Generated Project Architecture

### Build System
- **Gradle Kotlin DSL** with version catalog (`gradle/libs.versions.toml`)
- Centralized dependency management
- Configuration caching enabled
- Parallel builds enabled

### UI Layer
- **Material 3** design system with dynamic color support (Android 12+)
- Edge-to-edge rendering via `enableEdgeToEdge()`
- Dark/Light theme with automatic system detection
- Preview composable for Android Studio

### Testing
| Type | Framework | File |
|-------------------|-------------------|------------------------------------|
| Unit tests | JUnit 4 | `ExampleUnitTest.kt` |
| Instrumented tests| AndroidX Test | `ExampleInstrumentedTest.kt` |
| Compose UI tests | Compose UI Test | Built-in (via BOM) |

### CI/CD Pipelines

| Stage | GitHub Actions | GitLab CI |
|-----------|--------------------------------------------------|---------------------------------------------------|
| Validate | `lint` | `lint` |
| Test | `test` (unit tests) | `unit-test` |
| Build | `assembleDebug` (debug), `assembleRelease` + `bundleRelease` (release) | Same |
| Release | Auto GitHub Release on tag | Auto GitLab Release on tag |

### Signing Release Builds

The generated project supports two naming conventions for signing secrets โ€” modern (`ANDROID_*`) and legacy (`KEY_*`/`KEYSTORE_*`). Modern names take precedence; if neither is set, release builds fall back to the debug keystore (unsigned).

| Secret | Description |
|---------------------------|--------------------------------------|
| `ANDROID_SIGNING_KEY` | Base64-encoded keystore file |
| `ANDROID_KEYSTORE_PASSWORD` | Keystore password |
| `ANDROID_ALIAS` | Key alias |
| `ANDROID_KEY_PASSWORD` | Key password |
| `KEYSTORE_BASE64` | *(legacy)* Base64-encoded keystore |
| `KEYSTORE_PASSWORD` | *(legacy)* Keystore password |
| `KEY_ALIAS` | *(legacy)* Key alias |
| `KEY_PASSWORD` | *(legacy)* Key password |

> **Note:** When both a modern and legacy variable are present, the `ANDROID_*` variable wins. This is safe to configure alongside existing `KEY_*`/`KEYSTORE_*` secrets during migration.

---

## ๐ŸŽจ Icon Generation

The script creates **5 density sets** for both legacy and adaptive icons:

| Density | Legacy PNG | Adaptive Layer |
|-----------|------------|----------------|
| mdpi | 48ร—48 | 108ร—108 |
| hdpi | 72ร—72 | 162ร—162 |
| xhdpi | 96ร—96 | 216ร—216 |
| xxhdpi | 144ร—144 | 324ร—324 |
| xxxhdpi | 192ร—192 | 432ร—432 |

Plus a **512ร—512 Play Store icon** in the `fastlane/` directory.

**Placeholder mode**: If no logo is provided, the script generates a Material-style gradient icon with the first letter of your app name.

---

## ๐Ÿ”ง Version Management

Versions are **auto-fetched** at runtime from official sources:

| Component | Source |
|------------|-------------------------------|
| AGP | Google Maven |
| Kotlin | Maven Central |
| Gradle | services.gradle.org API |
| Compose BOM| Google Maven |
| core-ktx | Google Maven |
| lifecycle | Google Maven |
| activity-compose | Google Maven |

Fallback hardcoded versions are used if the network is unavailable.

---

## ๐Ÿงช Usage Examples

### Create a project with a custom logo
```bash
bash create-android-app.sh
# At the prompt, provide: /home/user/logo.png
```

### Create a project with dark icon background
```bash
bash create-android-app.sh
# At the prompt, provide icon background: #212121
```

### Generate and push to remote in one go
```bash
bash create-android-app.sh
# At the prompt, provide the Git Remote URL
```

---

## ๐Ÿค Contributing

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

---

## ๐Ÿ”’ Security

Report security issues to the project's security advisory. See [SECURITY.md](SECURITY.md).

---

## ๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the [LICENSE](LICENSE) file for details.

---

## ๐Ÿ™‹ FAQ

**Q: Can I use this on macOS?**
A: The script is designed for Linux. macOS support requires tweaks to dependency checks.

**Q: Do I need Android Studio?**
A: No. The generated project can be built entirely from the command line.

**Q: Can I customize the generated code?**
A: Yes! Fork the script and modify the heredoc templates to match your needs.

**Q: Will this work with older JDK versions?**
A: Java 17+ is required. Java 21 is recommended and tested.

---

## โญ Support

If you find this project useful, please give it a โญ on [GitHub](https://github.com/MaheshTechnicals/android-project-generator)!

---

*Made with โ™ฅ by [Mahesh Technicals](https://github.com/MaheshTechnicals)*