-
Notifications
You must be signed in to change notification settings - Fork 0
Development Setup
Hakim edited this page Sep 18, 2025
·
1 revision
Panduan lengkap untuk setup environment development Local YouTube Downloader Android.
- OS: Windows 10/11, macOS 10.14+, atau Linux (Ubuntu 18.04+)
- RAM: Minimum 8GB (16GB recommended untuk emulator)
- Storage: Minimum 10GB free space
- CPU: Intel i5/AMD Ryzen 5 atau lebih baik
- Android Studio: Flamingo (2022.3.1) atau lebih baru
- JDK: OpenJDK 11 atau Oracle JDK 11+
- Git: Latest version untuk version control
- Node.js: (Optional) untuk documentation tools
# Using Chocolatey
choco install openjdk11
# Or download from Oracle/OpenJDK website
# Set JAVA_HOME environment variable
setx JAVA_HOME "C:\Program Files\Java\jdk-11.0.x"# Using Homebrew
brew install openjdk@11
# Add to PATH
echo 'export PATH="/opt/homebrew/opt/openjdk@11/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc# Install OpenJDK 11
sudo apt update
sudo apt install openjdk-11-jdk
# Verify installation
java -version
javac -version- Download dari developer.android.com/studio
- Run installer dan pilih "Standard" installation
- Wait for SDK download (akan download ~3GB)
- Launch Android Studio setelah instalasi selesai
# Set Android Studio preferences
# File > Settings (Windows/Linux) atau Android Studio > Preferences (macOS)
# Configure:
- Appearance & Behavior > System Settings > Memory Settings
- IDE max heap size: 4096 MB
- Gradle max heap size: 4096 MBInstall SDK platforms yang diperlukan:
✅ Android 14 (API 34) - Target SDK
✅ Android 13 (API 33) - Recent version
✅ Android 11 (API 30) - Common version
✅ Android 7.0 (API 24) - Minimum SDK
Install tools yang diperlukan:
✅ Android SDK Build-Tools (latest)
✅ Android Emulator
✅ Android SDK Platform-Tools
✅ Intel x86 Emulator Accelerator (HAXM) - Windows/macOS
✅ Google Play services
✅ Google Repository
# Set ANDROID_HOME environment variable
# Windows
setx ANDROID_HOME "C:\Users\%USERNAME%\AppData\Local\Android\Sdk"
# macOS/Linux
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools# Windows (using Chocolatey)
choco install git
# macOS (using Homebrew)
brew install git
# Linux (Ubuntu/Debian)
sudo apt install git# Set global configuration
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# Configure line endings
git config --global core.autocrlf input # macOS/Linux
git config --global core.autocrlf true # Windows
# Set default branch name
git config --global init.defaultBranch main# Fork repository di GitHub UI, kemudian:
git clone https://github.com/YOUR_USERNAME/Local-Youtube-Downloader-Android.git
cd Local-Youtube-Downloader-Android
# Add upstream remote
git remote add upstream https://github.com/ORIGINAL_OWNER/Local-Youtube-Downloader-Android.git
# Verify remotes
git remote -v# Create development branch
git checkout -b develop
git push -u origin develop
# Create feature branches from develop
git checkout -b feature/your-feature-name- Launch Android Studio
- Click "Open" atau "Open an existing project"
- Navigate to cloned repository folder
- Select project folder dan click "OK"
- Wait for Gradle sync to complete
Local-Youtube-Downloader-Android/
├── app/ # Main application module
│ ├── src/main/java/ # Kotlin source code
│ ├── src/test/java/ # Unit tests
│ ├── src/androidTest/java/ # Instrumentation tests
│ └── build.gradle.kts # App-level build script
├── gradle/ # Gradle wrapper files
├── build.gradle.kts # Project-level build script
├── settings.gradle.kts # Project settings
└── local.properties # Local SDK path (auto-generated)
Update gradle.properties:
# Performance optimizations
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.caching=true
# Android optimizations
android.useAndroidX=true
android.enableJetifier=true
android.enableR8.fullMode=true
# Kotlin optimizations
kotlin.code.style=official
kotlin.incremental=true
kotlin.incremental.android=trueCreate/update local.properties:
# SDK location (auto-generated, verify path)
sdk.dir=/path/to/Android/Sdk
# Optional: NDK location if needed
# ndk.dir=/path/to/Android/Sdk/ndk/version# Clean and build
./gradlew clean
./gradlew build
# Build debug APK
./gradlew assembleDebug
# Run tests
./gradlew test
./gradlew connectedAndroidTestBUILD SUCCESSFUL in 2m 30s
45 actionable tasks: 45 executed
Verify in app/build.gradle.kts:
dependencies {
// Unit testing
testImplementation("junit:junit:4.13.2")
testImplementation("org.mockito:mockito-core:4.11.0")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
// Android testing
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
}// app/build.gradle.kts
android {
testOptions {
unitTests {
isIncludeAndroidResources = true
isReturnDefaultValues = true
}
}
}# Run all unit tests
./gradlew test
# Run specific test class
./gradlew test --tests "DownloadRepositoryTest"
# Run with coverage
./gradlew testDebugUnitTestCoverage# Run on connected device/emulator
./gradlew connectedAndroidTest
# Run specific test
./gradlew connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.irnhakim.ytmp3.ui.DownloadScreenTestFile > Settings > Editor > Code Style > Kotlin
- Use Kotlin official style guide
- Import scheme from kotlin-coding-conventions.xml
File > Settings > Editor > Inspections
- Enable Kotlin inspections
- Enable Android Lint checks
- Configure severity levels
File > Settings > Editor > Live Templates
- Add custom templates for common patterns
- Import Android/Kotlin templates
✅ Kotlin Multiplatform Mobile
✅ Android APK Support
✅ Database Navigator
✅ GitToolBox
✅ Rainbow Brackets
✅ String Manipulation
✅ Key Promoter X
File > Settings > Plugins > Marketplace
Search and install recommended plugins
// app/build.gradle.kts
android {
buildTypes {
debug {
isDebuggable = true
isMinifyEnabled = false
applicationIdSuffix = ".debug"
versionNameSuffix = "-debug"
}
}
}// Enable detailed logging in debug builds
if (BuildConfig.DEBUG) {
android.util.Log.d("YTMP3", "Debug logging enabled")
}1. Go to Settings > About Phone
2. Tap "Build Number" 7 times
3. Go back to Settings > Developer Options
4. Enable "USB Debugging"
5. Enable "Stay Awake" (optional)
# Verify device connection
adb devices
# Expected output:
# List of devices attached
# DEVICE_ID device1. Open AVD Manager in Android Studio
2. Click "Create Virtual Device"
3. Select device: Pixel 6 (recommended)
4. Select system image: API 34 (Android 14)
5. Configure AVD:
- Name: Pixel_6_API_34
- RAM: 4096 MB
- Internal Storage: 4 GB
- SD Card: 1 GB (optional)
Advanced Settings:
- Graphics: Hardware - GLES 2.0
- Boot option: Cold Boot
- Multi-Core CPU: 4 cores
- Enable Hardware Keyboard: Yes
# Update from upstream
git fetch upstream
git checkout main
git merge upstream/main
# Create/switch to feature branch
git checkout -b feature/new-feature
# Start Android Studio
# Open project
# Select device/emulator
# Run app (Shift+F10)# Make changes
# Run unit tests
./gradlew test
# Run app on device
./gradlew installDebug
# Debug if needed
# Use Android Studio debugger# Format code
./gradlew ktlintFormat
# Run static analysis
./gradlew lint
# Run tests
./gradlew test
# Build project
./gradlew assembleDebug# .github/workflows/ci.yml (example)
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '11'
- run: ./gradlew test
- run: ./gradlew assembleDebug# Clear Gradle cache
./gradlew clean
rm -rf ~/.gradle/caches/
# Invalidate caches in Android Studio
File > Invalidate Caches and Restart# Check ANDROID_HOME
echo $ANDROID_HOME # macOS/Linux
echo %ANDROID_HOME% # Windows
# Update local.properties
sdk.dir=/correct/path/to/Android/Sdk// Update app/build.gradle.kts
android {
compileSdk = 34
buildToolsVersion = "34.0.0"
}# Cold boot emulator
emulator -avd Pixel_6_API_34 -cold-boot
# Wipe emulator data
emulator -avd Pixel_6_API_34 -wipe-data- Architecture Overview - Understand app structure
- API Reference - Component documentation
- Contributing Guide - Contribution workflow
🎉 Development Environment Ready! You're now set up for productive Android development with this project.
Next Steps:
- Quick Start - Build and run the app
- Contributing Guide - Make your first contribution
- Architecture Overview - Understand the codebase