Metadata-Version: 2.4
Name: apk-builder-web
Version: 1.0.0
Summary: Convert any website URL or ZIP file into an Android APK — run it locally or deploy it anywhere
Author: Ayaan
License: MIT
Keywords: apk,android,webview,web-to-apk,apk-builder,html-to-apk,zip-to-apk
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: flask>=3.0.0
Requires-Dist: flask-socketio>=5.3.6
Requires-Dist: flask-cors>=4.0.0
Requires-Dist: python-socketio>=5.10.0
Requires-Dist: python-engineio>=4.9.0
Requires-Dist: requests>=2.31.0
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: Pillow>=10.0.0
Requires-Dist: Werkzeug>=3.0.0
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: ruff; extra == "dev"

# APK Builder – Web to Android APK Converter

Convert any **website URL** or **ZIP file** containing HTML/CSS/JS into an installable Android APK.

---

## Features

| Feature | Description |
|---|---|
| 🌐 URL → APK | Wrap any live website in a native Android WebView |
| 📦 ZIP → APK | Package your local web app ZIP (must contain `index.html`) |
| ⬇️ Offline mode | Download & bundle a website for offline use |
| ⚙️ Custom config | App name, package ID, version, orientation, status-bar color |
| 🎨 Custom icon | Upload a PNG icon (512×512 recommended) |
| 📲 Dual output | Direct APK download *or* Android Studio project ZIP |
| 🔴 Real-time log | Live build output via Socket.io |

---

## Quick Start

### Prerequisites

| Requirement | Notes |
|---|---|
| **Node.js ≥ 18** | [nodejs.org](https://nodejs.org) |
| **Java JDK 17+** | Required for Gradle |
| **Android SDK** | Part of [Android Studio](https://developer.android.com/studio) |

> **Without Java/Android SDK** the tool still works — it generates an Android Studio project ZIP you can open and build manually.

---

### 1. Install & Run

**Windows:**
```bat
install.bat
```

**macOS / Linux:**
```sh
chmod +x install.sh && ./install.sh
```

**Manual:**
```sh
npm install
node server.js
```

Open **http://localhost:3000** in your browser.

---

### 2. Set up Android SDK (for direct APK building)

1. Install [Android Studio](https://developer.android.com/studio)
2. Open Android Studio → SDK Manager → Install **Android SDK Platform 34**
3. Set `ANDROID_HOME` environment variable:
   - **Windows:** `%LOCALAPPDATA%\Android\Sdk`
   - **macOS:** `~/Library/Android/sdk`
   - **Linux:** `~/Android/Sdk`
4. Add Gradle to PATH (Android Studio bundles it at `<studio>/plugins/gradle/lib/gradle-launcher-*.jar`)

---

### 3. Build an APK

1. Open **http://localhost:3000**
2. Choose **Web URL** or **ZIP File** tab
3. Fill in app name, package name (e.g. `com.yourname.appname`)
4. Click **Build APK**
5. Watch the real-time build log
6. Download the APK or the Android Studio project

---

## Project Structure

```
APK BUILDER/
├── server.js              ← Express + Socket.io server
├── package.json
├── public/
│   ├── index.html         ← Web UI
│   ├── style.css
│   └── script.js
├── utils/
│   ├── buildApk.js        ← Android project generator + Gradle runner
│   ├── webScraper.js      ← Website downloader (offline mode)
│   └── zipHandler.js      ← ZIP extractor
├── templates/
│   └── android/           ← Android project template
│       ├── app/
│       │   ├── build.gradle
│       │   └── src/main/
│       │       ├── AndroidManifest.xml
│       │       ├── assets/www/    ← web files placed here
│       │       ├── java/          ← MainActivity.java (generated)
│       │       └── res/
│       ├── build.gradle
│       ├── settings.gradle
│       ├── gradle.properties
│       └── gradlew / gradlew.bat
├── uploads/               ← Temporary upload storage (auto-created)
└── builds/                ← Build outputs (auto-created)
    └── <buildId>/
        ├── app-debug.apk  ← Built APK (if Gradle available)
        └── project.zip    ← Android Studio project
```

---

## How It Works

1. **ZIP/URL source** → web files extracted/downloaded to a temp folder
2. **Android project** created from the template with app settings applied
3. **Web files** copied into `app/src/main/assets/www/`
4. **MainActivity.java** generated to load `file:///android_asset/www/index.html`
   (or the live URL in online mode)
5. **Gradle** builds the APK if Android SDK is available
6. APK (or project ZIP) served for download

---

## Deploying to Another Machine / Server

```sh
# On the target machine
git clone <this-repo>   # or copy the folder
npm install
node server.js
```

Set `PORT` env var to change the port:
```sh
PORT=8080 node server.js
```

---

## FAQ

**Q: The APK installs but shows a blank screen.**  
A: Make sure your web app works from `index.html` at the root of the ZIP. Paths must be relative.

**Q: I see "Gradle not found" in the log.**  
A: That's fine — download the project ZIP, open in Android Studio, and click ▶ Run.

**Q: How do I sign the APK for release / Play Store?**  
A: The debug APK is self-signed. For release, open the project in Android Studio → Build → Generate Signed Bundle/APK.

**Q: Can I run this on a VPS/server?**  
A: Yes. Without Android SDK on the server, users always get a project ZIP. With Android SDK installed server-side (e.g. via `sdkmanager`), you get full APK builds.

---

## License

MIT
