08.install_android_tools.sh 840 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. # Set superuser privileges command if not set
  7. if [[ -z $su ]]; then
  8. export su="sudo"
  9. fi
  10. $su apt-get -y --fix-missing install adb
  11. $su apt-get -y --fix-missing install android-sdk
  12. $su apt-get -y --fix-missing install android-sdk-platform-tools
  13. $su apt-get -y --fix-missing install android-sdk-platform-tools-common
  14. $su apt-get -y --fix-missing install android-sdk-build-tools
  15. $su apt-get -y --fix-missing install fastboot
  16. $su apt-get -y --fix-missing install scrcpy
  17. $su usermod -aG plugdev $LOGNAME
  18. {
  19. echo ""
  20. echo "# android path"
  21. echo "export ANDROID_HOME=/usr/lib/android-sdk/"
  22. echo "export PATH=\$PATH:\$ANDROID_HOME/tools:\$ANDROID_HOME/platform-tools"
  23. }>>~/.bashrc
  24. # login again or source this file to add android emulator to user path
  25. source ~/.bashrc