How to install Android SDK on Ubuntu?

前端 未结 7 1085
予麋鹿
予麋鹿 2020-12-22 18:24

For my Ubuntu machine, I downloaded the latest version of Android SDK from this page.

After extracting the downloaded .tgz file, I was trying to search for installati

相关标签:
7条回答
  • 2020-12-22 18:50

    To install it on a Debian based system simply do

    # Install latest JDK
    sudo apt install default-jdk
    
    # install unzip if not installed yet
    sudo apt install unzip
    
    # get latest sdk tools - link will change. go to https://developer.android.com/studio/#downloads to get the latest one
    cd ~
    wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
    
    # unpack archive
    unzip sdk-tools-linux-4333796.zip
    
    rm sdk-tools-linux-4333796.zip
    
    mkdir android-sdk
    mv tools android-sdk/tools
    

    Then add the Android SDK to your PATH, open ~/.bashrc in editor and add the following lines into the file

    # Export the Android SDK path 
    export ANDROID_HOME=$HOME/android-sdk
    export PATH=$PATH:$ANDROID_HOME/tools/bin
    export PATH=$PATH:$ANDROID_HOME/platform-tools
    
    # Fixes sdkmanager error with java versions higher than java 8
    export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
    

    Run

    source ~/.bashrc
    

    Show all available sdk packages

    sdkmanager --list
    

    Identify latest android platform (here it's 28) and run

    sdkmanager "platform-tools" "platforms;android-28"
    

    Now you have adb, fastboot and the latest sdk tools installed

    0 讨论(0)
  • 2020-12-22 18:54
    sudo add-apt-repository -y ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer oracle-java7-set-default
    wget https://dl.google.com/dl/android/studio/ide-zips/2.2.0.12/android-studio-ide-145.3276617-linux.zip
    unzip android-studio-ide-145.3276617-linux.zip
    cd android-studio/bin
    ./studio.sh
    
    0 讨论(0)
  • 2020-12-22 19:00

    There is no need to download any binaries or files or follow difficult installation instructions.

    All you really needed to do is:

    sudo apt update && sudo apt install android-sdk
    

    Update: Ubuntu 18.04 only

    0 讨论(0)
  • 2020-12-22 19:09

    Option 1:

    sudo apt update && sudo apt install android-sdk
    

    The location of Android SDK on Linux can be any of the following:

    • /home/AccountName/Android/Sdk

    • /usr/lib/android-sdk

    • /Library/Android/sdk/

    • /Users/[USER]/Library/Android/sdk

    Option 2:

    • Download the Android Studio.

    • Extract downloaded .zip file.

      The extracted folder name will read somewhat like android-studio

    To keep navigation easy, move this folder to Home directory.

    • After moving, copy the moved folder by right clicking it. This action will place folder's location to clipboard.

    • Use Ctrl Alt T to open a terminal

    • Go to this folder's directory using cd /home/(USER NAME)/android-studio/bin/

    • Type this command to make studio.sh executable: chmod +x studio.sh

    • Type ./studio.sh

    A pop up will be shown asking for installation settings. In my particular case, it is a fresh install so I'll go with selecting I do not have a previous version of Studio or I do not want to import my settings.

    If you choose to import settings anyway, you may need to close any old project which is opened in order to get a working Android SDK.

    ./studio.sh popup

    From now onwards, setup wizard will guide you.

    Android studio setup wizard

    Android Studio can work with both Open JDK and Oracle's JDK (recommended). Incase, Open JDK is installed the wizard will recommend installing Oracle Java JDK because some UI and performance issues are reported while using OpenJDK.

    The downside with Oracle's JDK is that it won't update with the rest of your system like OpenJDK will.

    The wizard may also prompt about the input problems with IDEA .

    Select install type

    Select Android studio install type

    Verify installation settings

    Verify Android studio installation settings

    An emulator can also be configured as needed.

    Android studio emulator configuration prompt

    The wizard will start downloading the necessary SDK tools

    The wizard may also show an error about Linux 32 Bit Libraries, which can be solved by using the below command:

    sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1

    After this, all the required components will be downloaded and installed automatically.

    After everything is upto the mark, just click finish

    Completed installation of Android studio

    To make a Desktop icon, go to 'Configure' and then click 'Create Desktop Entry'

    Creating Android studio desktop icon

    Creating Android studio desktop icon for one or multiple users

    source

    0 讨论(0)
  • 2020-12-22 19:16

    Android SDK Manager

    sudo snap install androidsdk
    

    Usage

    You can use the sdkmanager to perform the following tasks.

    List installed and available packages

    androidsdk --list [options]
    

    Install packages

    androidsdk packages [options]
    

    The packages argument is an SDK-style path as shown with the --list command, wrapped in quotes (for example, "build-tools;29.0.0" or "platforms;android-28"). You can pass multiple package paths, separated with a space, but they must each be wrapped in their own set of quotes.

    For example, here's how to install the latest platform tools (which includes adb and fastboot) and the SDK tools for API level 28:

    androidsdk "platform-tools" "platforms;android-28"
    

    Alternatively, you can pass a text file that specifies all packages:

    androidsdk --package_file=package_file [options]
    

    The package_file argument is the location of a text file in which each line is an SDK-style path of a package to install (without quotes).

    To uninstall, simply add the --uninstall flag:

    androidsdk --uninstall packages [options]
    androidsdk --uninstall --package_file=package_file [options]
    

    Update all installed packages

    androidsdk --update [options]
    

    Note

    androidsdk it is snap wraper of sdkmanager all options of sdkmanager work with androidsdk

    Location of installed android sdk files : /home/user/AndroidSDK

    See all sdkmanager options in google documentation

    0 讨论(0)
  • 2020-12-22 19:17

    If you are on Ubuntu 17.04 (Zesty), and you literally just need the SDK (no Android Studio), you can install it like on Debian:

    • sudo apt install android-sdk android-sdk-platform-23
    • export ANDROID_HOME=/usr/lib/android-sdk
    • In build.gradle, change compileSdkVersion to 23 and buildToolsVersion to 24.0.0
    • run gradle build
    0 讨论(0)
提交回复
热议问题