# AntiCloudManager: Environment Configuration Guide

This document describes how to configure environment settings, toolchains, build properties, and developer signing parameters for **AntiCloudManager**.

---

## 🛠️ 1. Development Environment Prerequisites

To develop, customize, or build the application, ensure the following tools are configured:

### 1.1 Java Development Kit (JDK 17)
* Recommended: Eclipse Temurin JDK 17 (or Microsoft OpenJDK 17).
* Environment variable configuration:
  ```powershell
  # Windows PowerShell
  $env:JAVA_HOME = "C:\Program Files\Eclipse Adoptium\jdk-17.0.20.101-hotspot"
  $env:PATH = "$env:JAVA_HOME\bin;$env:PATH"
  ```
  Verify via:
  ```bash
  java -version
  ```

### 1.2 Android SDK & Command-Line Tools
* Ensure `ANDROID_HOME` points to your Android SDK directory:
  ```powershell
  $env:ANDROID_HOME = "$env:LOCALAPPDATA\Android\Sdk"
  $env:PATH = "$env:ANDROID_HOME\platform-tools;$env:ANDROID_HOME\cmdline-tools\latest\bin;$env:PATH"
  ```
* Required SDK packages:
  * `platforms;android-34` or `platforms;android-35`
  * `build-tools;34.0.0` or `build-tools;35.0.0`
  * `platform-tools`
  * `cmdline-tools;latest`

### 1.3 Flutter SDK
* Antigravity / Flutter 3.24+ (Dart 3.5+)
* Add flutter to system PATH:
  ```powershell
  $env:PATH = "C:\Users\asus\development\flutter\bin;$env:PATH"
  ```

---

## ⚙️ 2. Android Gradle Configuration

The project is structured according to contemporary Flutter and Android Gradle Plugin (AGP) guidelines:

### 2.1 `android/settings.gradle.kts`
* Includes plugins via Gradle Plugin Portal & Google Maven:
  * `com.android.application` (v8.3.2)
  * `org.jetbrains.kotlin.android` (v1.9.24)
  * `dev.flutter.flutter-plugin-loader` (v1.0.0)

### 2.2 `android/app/build.gradle.kts`
* **Application ID:** `com.antigravity.cloudstorage.anti_cloud_manager`
* **Compile SDK:** `35`
* **Min SDK:** `24` (Android 7.0 Nougat - required for WorkManager & Google Play Services)
* **Target SDK:** `35` (Android 15)
* **Java Version:** `JavaVersion.VERSION_17`
* **JVM Target:** `17`

---

## 🔑 3. Release Signing Configuration

For publishing to Google Play Store or producing a signed production APK:

1. Generate a keystore file:
   ```bash
   keytool -genkey -v -keystore android/app/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
   ```
2. Create `android/key.properties`:
   ```properties
   storePassword=<your-keystore-password>
   keyPassword=<your-key-password>
   keyAlias=upload
   storeFile=../upload-keystore.jks
   ```
3. Update `android/app/build.gradle.kts` signingConfigs to load `key.properties`.
4. Run:
   ```bash
   flutter build apk --release
   # or
   flutter build appbundle --release
   ```

---

## 🌐 4. Custom API Endpoints (Flask Companion)

AntiCloudManager is designed as a standalone decentralized client directly interfacing with SQLite and Google Drive API. If an optional enterprise backend server is introduced (such as a Flask service for centralized fleet telemetry or custom AI media indexing), configure the base URL in `lib/services/api_config.dart`:
```dart
class ApiConfig {
  static const String backendUrl = "https://your-flask-service.internal";
}
```
In default mode, all data stays purely on-device and communicates directly with official Google Drive endpoints.
