Install Android Studio on Windows; the first-run wizard downloads the SDK and an emulator
winget install Google.AndroidStudioMake sure the wizard selects Android SDK, SDK Platform-Tools and at least one API level
Set up Kotlin and Android: Android Studio, cmdline-tools and SDKs, ANDROID_HOME, Gradle mirrors, emulators, adb debugging and common error fixes.
Install Android Studio on Windows; the first-run wizard downloads the SDK and an emulator
winget install Google.AndroidStudioMake sure the wizard selects Android SDK, SDK Platform-Tools and at least one API level
Install Android Studio with Homebrew on macOS or snap on Ubuntu
# macOS
brew install --cask android-studio
# Ubuntu
sudo snap install android-studio --classicInstall platform-tools, a specific API platform and build tools from the CLI
sdkmanager --list
sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0"sdkmanager lives in cmdline-tools/latest/bin; add it to PATH first
Install a system image for creating AVDs
sdkmanager --install "system-images;android-34;google_apis;x86_64"AGP 8.x requires JDK 17, so install one for Gradle to use
winget install EclipseAdoptium.Temurin.17.JDKAdd the Aliyun repo to pluginManagement in settings.gradle.kts to speed up plugin resolution
pluginManagement {
repositories {
maven { url = uri("https://maven.aliyun.com/repository/gradle-plugin") }
google()
mavenCentral()
}
}Declare dependency repositories once in settings.gradle.kts instead of per module
dependencyResolutionManagement {
repositories {
maven { url = uri("https://maven.aliyun.com/repository/public") }
google()
mavenCentral()
}
}Inspect global Gradle properties where proxy and JVM memory settings live
# Windows
type %USERPROFILE%\.gradle\gradle.properties
# macOS / Linux
cat ~/.gradle/gradle.propertiesWrite this into ~/.gradle/gradle.properties so Gradle downloads go through the proxy
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=7890
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=7890Raise the Gradle heap and pin file encoding to avoid stalls and mojibake
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8Set ANDROID_HOME and add platform-tools to PATH so adb can be called directly
# Windows
setx ANDROID_HOME "%LOCALAPPDATA%\Android\Sdk"
setx PATH "%PATH%;%ANDROID_HOME%\platform-tools"
# macOS / Linux
echo 'export ANDROID_HOME="$HOME/Library/Android/sdk"' >> ~/.zshrcConfirm the variable points at a real SDK directory containing platforms and build-tools
echo %ANDROID_HOME%
# macOS / Linux
echo $ANDROID_HOMEPoint Gradle at JDK 17 to avoid AGP version checks failing
# Windows PowerShell
[Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Eclipse Adoptium\jdk-17", "User")Verify adb works and list connected devices or emulators
adb version
adb devicesVerify the JDK and Gradle wrapper versions; always use the wrapper instead of a local gradle
java -version
./gradlew --versionList and create AVDs; the Device Manager in Android Studio does the same
avdmanager list avd
avdmanager create avd -n pixel_34 -k "system-images;android-34;google_apis;x86_64"Launch an emulator from the CLI; add -no-window on headless machines
emulator -list-avds
emulator -avd pixel_34Build the debug APK under app/build/outputs/apk/debug
./gradlew assembleDebugInstall on the device and launch the main activity
./gradlew installDebug
adb shell am start -n com.example.app/.MainActivityCheck the standalone Kotlin compiler version; Android projects usually let the Gradle plugin manage it
kotlinc -versionInstall Kotlin language support and the Gradle task panel in VS Code
code --install-extension mathiasfrohlich.kotlin
code --install-extension vscjava.vscode-gradleIntelliJ IDEA Community works for pure Kotlin/JVM; Android still favors Android Studio
winget install JetBrains.IntelliJIDEA.CommunityFilter logcat down to crash logs for fast runtime stack traces
adb logcat -s AndroidRuntimeAccept the SDK licenses when builds fail on unaccepted agreements
sdkmanager --licensesRestart the adb server when the device list is empty or shows offline
adb kill-server
adb start-server
adb devicesStop the Gradle daemon and rebuild without it when builds hang
./gradlew --stop
./gradlew clean assembleDebug --no-daemonDelete the module cache when dependencies are corrupt; the next build re-downloads them
rm -rf ~/.gradle/caches/modules-2Trace dependency conflicts and duplicate or mismatched library versions
./gradlew :app:dependencies --configuration debugRuntimeClasspathRoute device traffic through the host proxy for packet capture debugging
adb shell settings put global http_proxy 127.0.0.1:7890This website uses cookies to ensure you get the best experience on our website. Privacy Policy.