(2023) mac installs Android studio (including installing jdk, Android SDK)

1. Install jdk and configure environment variables

1. Download and install jdk

URL: Java Downloads | Oracle

Note that you need to register and log in before downloading.

Choose to download java8, jdk1.8. Just open and install.

2. Configure environment variables

Open the terminal, enter java -version, you can see the jdk version;

 Check the location of jdk, /usr/libexec/java_home -V; write down this path, which will be used to configure environment variables later;

Then open the .bash_prfile file, if not, touch .bash_profile to create a new one;

Add the following:

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH

Among them, the first JAVA_HOME needs to be changed to its own path, which is found in the previous step.

After the configuration is complete, enter the command echo $JAVA_HOME to verify.

 

2. Download and install Android studio

Official website: https://developer.android.com/studio

Just download the latest version;

According to your computer chip type, choose intel or apple chip, download the corresponding installation package and drag it in;

 After opening, do some configuration according to the installation wizard, and keep selecting next until the installation is successful.

3. Software configuration and installation of Android SDK

After starting the software and opening the project, some things need to be installed, and it takes a long time to open it for the first time.

 1. Select the jdk version

Menu->Android Studio->Preferences

Build, Execution, Deployment->Build Tools->Gradle

The jdk version can be switched.

2. Install SDK and configure environment variables

Menu->Android Studio->Preferences

Appearances & Behavior->System Settings->Android SDK

If you install the sdk, select the version to be installed and click the Apply button to start downloading and installing.

 Configure the sdk environment variable, open the .bash_profile file, and add the following content: (The specific sdk path can also be viewed in Android Studio)

export ANDROID_HOME=/Users/qa/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin

Finally source .bash_profile;

After installing the Android sdk, the adb command can be used normally.

Guess you like

Origin blog.csdn.net/Vermouth_00/article/details/129044442