efxtv

Install Android SDK Command Line Tools on Ubuntu Without Android Studio

Apr 14th, 2025 (edited)
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | Cybersecurity | 0 0
  1. How to Install Android SDK Command Line Tools in Ubuntu Linux
  2.  
  3. ##################################################################
  4. Join our telegram channel for more : https://t.me/LinuxClassesEFXTv
  5. ##################################################################
  6.  
  7. # 0) Install these packages in Ubuntu for Android SDK/CLI builds:
  8. sudo apt install openjdk-17-jdk wget unzip git curl zip libc6 libstdc++6 libgcc1 lib32stdc++6 lib32z1 lib32ncurses6 libxi6 libxtst6 libxrender1 ca-certificates
  9.  
  10. # 1) Create SDK dir
  11. mkdir -p "$HOME/android/sdk/cmdline-tools"
  12. cd "$HOME/android/sdk"
  13.  
  14. # 2) Download latest command-line tools (Linux)
  15. wget https://dl.google.com/android/repository/commandlinetools-linux-13114758_latest.zip
  16. unzip cmdline-tools.zip
  17. rm commandlinetools-linux-13114758_latest
  18.  
  19. # 3) Move into proper "latest" layout expected by sdkmanager
  20. mkdir -p "$HOME/android/sdk/cmdline-tools/latest"
  21. mv cmdline-tools/* "$HOME/android/sdk/cmdline-tools/latest/"
  22. rmdir cmdline-tools (please correct it so that final path should be ~/android/sdk/cmdline-tools/latest/bin)
  23.  
  24. # 5) Accept licenses non‑interactively
  25. yes | sdkmanager --licenses
  26.  
  27. # 6) Create .bashrc file with env for Android SDK
  28. cat >> "$HOME/.bashrc" <<'EOF'
  29. export ANDROID_SDK_ROOT="$HOME/android/sdk"
  30. export ANDROID_HOME="$HOME/android/sdk"
  31. export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/emulator"
  32. EOF
  33.  
  34. # 7) Install
  35. sdkmanager \
  36. "platform-tools" \
  37. "platforms;android-34" \
  38. "build-tools;34.0.0" \
  39. "cmdline-tools;latest" \
  40. "extras;android;m2repository" \
  41. "extras;google;m2repository"
  42.  
  43. # 8) Source
  44. source $HOME/.bashrc'
  45.  
  46. # # How to build an app?
  47. Step 0: Git clone repository
  48. git clone https://github.com/efxtv/Website-To-APP.git
  49.  
  50. Step 1: Provide execution permission to gradlew
  51. chmod +x gradlew
  52.  
  53. Step 2 : Build application.apk
  54. ./gradlew assembleDebug
  55.  
  56. Step 3: APK output path (example)
  57. ls app/build/outputs/apk/debug/
  58.  
Advertisement
Add Comment
Please, Sign In to add comment