Android Studio installation environment construction

JDK download: https://www.oracle.com/java/technologies/downloads/#java8
Choose your own corresponding version to download.
![image.png](https://img-blog.csdnimg.cn/img_convert/d2dbe3db9a7a0a7d08de487c127327ff.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=518&id=u125b 62a3&margin=[object Object ]&name=image.png&originHeight=1036&originWidth=2582&originalType=binary&ratio=1&rotation=0&showTitle=false&size=220052&status=done&style=none&taskId=ub3c0de93-e9fb-4c97-b25f-dd02b85c0 af&title=&width=1291) Open the file after downloading the file, and the installation will
appear The wizard, usually click next all the way.

JDK-related environment variables.

Mac configuration JDK:

Before configuring the environment, we must know the installation path of the JDK. This is the key to configuring environment variables. If you don’t know, please enter the following string in the terminal to query:

/usr/libexec/java_home -V

![image.png](https://img-blog.csdnimg.cn/img_convert/46fc058646a6b50102500dc47df28f59.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=103&id=u 49d7bbb7&margin=[object Object ]&name=image.png&originHeight=206&originWidth=1140&originalType=binary&ratio=1&rotation=0&showTitle=false&size=58267&status=done&style=none&taskId=u6108ee60-e96f-499b-b856-18249fc4b be&title=&width=570) input the above string, it will output JDK
installation Path, copy this path for the time being, and use it later.

Then we enter the corresponding statement in the terminal: If we are configuring environment variables for the first time, please enter touch .bash_profile, a hidden file of .bash_profile will be created, but if you are not configuring environment variables for the first time, please directly Use the open -e .bash_profile or open ~/.bash_profile command to open.
**Note:** The file name must be .bash_profile, and the command lines such as touch .bash_profile, open .bash_profile, source .bash_profile must be executed under the Home path. When the Terminal program is opened, it is under the Home path by default. But if you are not currently under the Home path, you need to return to the Home path to proceed.
At the very beginning, the system will automatically read ~/.bash_profile, which is the specified file under the Home file. So this requires us to write it under the Home file, and the name must be bash_profile.

Open ~/.bash_profile Open it. This is:!
[Image.png] (https://img-wlog.csdnimg.cn/img_convert/3A684411cea048bea2443501A38Eab.png#Clientid=u99388888 1FA1-B15B-4 & CROP = 0 & CROP = 0 & CROP = 1 & CROP = 1 & FROM = paste&height=118&id=u648120ae&margin=[object Object]&name=image.png&originHeight=236&originWidth=1354&originalType=binary&ratio=1&rotation=0&showTitle=false&size=55225&status=done&style=none&taskId=ue7 ca186e-755f-4890-a12d-0ab1b736769&title=&width=677) First
, The first parameter, JAVA_HOME, this sentence should be written by yourself

JAVA_HOME=jdk路径

JAVA_HOME is the installation path of JDK. This path is different because the installation directory set by each person when installing JDK is different. Paste the text you just copied here, which is basically correct. But if there are special characters such as spaces in the current installation path, remember to add escape characters!
Then for the other few sentences, copy the following:

PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH

Save the file and close it when you're done writing.
Then go back to the terminal and use source .bash_profile to make the configuration just written take effect.

Finally, we can enter the java -version statement in the terminal to confirm whether the configuration is effective: ![image.png](https://img-blog.csdnimg.cn/img_convert/4d76d68c3555220579ac867329e06129.png#clientId=u236fa0bd-be1f-4&crop= 0&crop=0&crop=1&crop=1&from=paste&height=75&id=u83b03a99&margin=[object Object]&name=image.png&originHeight=150&originWidth=1018&originalType=binary&ratio=1&rotation=0&showTitle=false&size=36725& status=done&style=none&taskId=uea55085a-c1bf-4038-bc0f- 9370e5ddae3&title=&width=509)

Windows configuration JDK:

1. Windows environment variable modification: click the computer icon - properties - advanced system settings - advanced - environment variables

![image.png](https://img-blog.csdnimg.cn/img_convert/8752693773e48331964b7a293e4266b0.png#clientId=u53ad8cc6-0c5b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=337&id=u0fdd7ee2&margin=[object Object]&name=image.png&originHeight=1000&originWidth=1280&originalType=binary&ratio=1&rotation=0&showTitle=false&size=59184&status=done&style=none&taskId=u728e295b-ab4f-4ce2-9816-e829e86cd70&title=&width=431)

2. Create a new variable named: JAVA_HOM: the value is the jdk path.

![image.png](https://img-blog.csdnimg.cn/img_convert/9e05e4abde439673279faa347ea365e0.png#clientId=u53ad8cc6-0c5b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=157&id=SJE8a&margin=[object Object]&name=image.png&originHeight=313&originWidth=761&originalType=binary&ratio=1&rotation=0&showTitle=false&size=13940&status=done&style=none&taskId=u5ebb9170-6def-4114-9dd0-b2f3d67adcf&title=&width=380.5)

3. Double-click to open the path.

![image.png](https://img-blog.csdnimg.cn/img_convert/fc29a6e71060b0fbf67fe9cd94b6c9ff.png#clientId=u53ad8cc6-0c5b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=157&id=u58673f75&margin=[object Object]&name=image.png&originHeight=313&originWidth=761&originalType=binary&ratio=1&rotation=0&showTitle=false&size=16398&status=done&style=none&taskId=u3fc2d083-0f02-4a54-9886-dbac9343e91&title=&width=380.5)

4. Create 2 or less paths.

%JAVA_HOME%\bin
%JAVA_HOME%\jre\bin

![image.png](https://img-blog.csdnimg.cn/img_convert/3dc32c172d724bfe51a2e57313c93e7b.png#clientId=u53ad8cc6-0c5b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=478&id=u3e5c4305&margin=[object Object]&name=image.png&originHeight=1326&originWidth=1334&originalType=binary&ratio=1&rotation=0&showTitle=false&size=271451&status=done&style=none&taskId=u73879149-2bf0-43ba-adff-53fff232916&title=&width=481)

5. Click OK to exit, and confirm again to save the current environment variable.

Configuration of the Android Studio environment:

macOS AS environment variables

![image.png](https://img-blog.csdnimg.cn/img_convert/947e0562964d062575c6b23236fcd65a.png#clientId=u53ad8cc6-0c5b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=74&id=AJbi4&margin=[object Object]&name=image.png&originHeight=148&originWidth=1372&originalType=binary&ratio=1&rotation=0&showTitle=false&size=42095&status=done&style=none&taskId=u0265beb2-90ce-48ad-89ec-82803502b9d&title=&width=686)

  1. open ~/.bash_profile file
  2. ANDROID_HOME needs to write the local android sdk file path
  3. Copy the following code directly and save
  4. Create a new terminal and enter source .bash_profile
export ANDROID_HOME= android sdk文件路径
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools

Windows AS environment variables

1. Windows environment variable modification: click the computer icon - properties - advanced system settings - advanced - environment variables

![image.png](https://img-blog.csdnimg.cn/img_convert/a2350119a8fa0db8126e67046a98146f.png#clientId=u53ad8cc6-0c5b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=500&id=ufd5806ca&margin=[object Object]&name=image.png&originHeight=1000&originWidth=1280&originalType=binary&ratio=1&rotation=0&showTitle=false&size=59184&status=done&style=none&taskId=uaa8406c9-d8bc-403e-a746-5a99526f384&title=&width=640)

2. Create a new variable named: ANDROID_HOME: the value is the Android SDK path.

![image.png](https://img-blog.csdnimg.cn/img_convert/bdfa1055577b73631414b4c3b4323060.png#clientId=u53ad8cc6-0c5b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=157&id=u484f73f5&margin=[object Object]&name=image.png&originHeight=313&originWidth=761&originalType=binary&ratio=1&rotation=0&showTitle=false&size=17875&status=done&style=none&taskId=u6c466735-5a55-425e-b3a9-cad0264b377&title=&width=380.5)

3. Double-click to open the path.

![image.png](https://img-blog.csdnimg.cn/img_convert/ed314387e48ee2a469e1d5f00555837d.png#clientId=u53ad8cc6-0c5b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=157&id=u4d860d6c&margin=[object Object]&name=image.png&originHeight=313&originWidth=761&originalType=binary&ratio=1&rotation=0&showTitle=false&size=25402&status=done&style=none&taskId=u6f8dba0d-c353-4bb7-bfe2-0e72a907753&title=&width=380.5)

4. Create 2 or less paths.

%ANDROID_HOME%\tools
%JAVA_HOME%\jre\bin

![image.png](https://img-blog.csdnimg.cn/img_convert/9922db1914253a71261cd809d2814b76.png#clientId=u53ad8cc6-0c5b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=578&id=u5c386f95&margin=[object Object]&name=image.png&originHeight=1338&originWidth=1354&originalType=binary&ratio=1&rotation=0&showTitle=false&size=275967&status=done&style=none&taskId=uf1a54082-6d02-4ec0-880e-c65bb927b6a&title=&width=585)

5. Click OK to exit, and confirm again to save the current environment variable.

Android Studio download:

Official website address: official website link address
Chinese address: domestic Chinese link address

Install

![image.png](https://img-blog.csdnimg.cn/img_convert/196a8df065a746faf101a2906b19feba.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=486&id=uaa8728ca&margin=[object Object]&name=image.png&originHeight=974&originWidth=1240&originalType=binary&ratio=1&rotation=0&showTitle=false&size=357783&status=done&style=none&taskId=ua23efdfd-6de9-40b3-84cc-bbb463a8384&title=&width=619)

All the way to next is like a fool's installation . Do not bring Chinese in the installation path
! =1&from=paste&height=488&id=uaea99405&margin=[object Object]&name=image.png&originHeight=976&originWidth=1246&originalType=binary&ratio=1&rotation=0&showTitle=false&size=212287&status=done&style=none&ta skId=u444ab6fe-5a7c-459f-9390-5cccba14968&title=&width=623 )

basic settings

![image.png](https://img-blog.csdnimg.cn/img_convert/c26bca6585c0320ec709ac44bd26d5d4.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=283&id=ufcf9d5d1&margin=[object Object]&name=image.png&originHeight=212&originWidth=467&originalType=binary&ratio=1&rotation=0&showTitle=false&size=13995&status=done&style=none&taskId=uf669e7d7-7c6e-40b1-b425-edb476b4fa9&title=&width=623.5)

Next, operate normally. The following error occurs.
The reason for the error here is that your computer does not have an SDK and the android studio you downloaded does not have an SDK. Here
we first select cancel, skip it, and then add the SDK in the settings
! [image.png](https://img-blog .csdnimg.cn/img_convert/c554db5e48efb5536ebcd7b26c545bc4.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=227&id=ue7499b57&margin=[object Object] &name=image.png&originHeight=145&originWidth=400&originalType=binary&ratio=1&rotation =0&showTitle=false&size=11626&status=done&style=none&taskId=ub62f3f02-53cf-4e94-aab2-ae019909bb1&title=&width=626)

Select jdk Here AS comes with an internal jdk, or you can choose a local existing jdk.
Install the SDK by default and select all
without Chinese characters and spaces in the installation path
! =1&from=paste&height=477&id=udcd22457&margin=[object Object]&name=image.png&originHeight=742&originWidth=984&originalType=binary&ratio=1&rotation=0&showTitle=false&size=57878&status=done&style=none&taskId =uab46c834-da27-4b67-b2aa-5232fbb18b1&title=&width=633 )

The default memory allocation is 2GB,
it is best not to be less than 2GB. If the memory is large, you can allocate more
! 0&crop=0&crop=1&crop=1&from=paste&height=474&id=ucd1d7fea&margin=[object Object]&name=image.png&originHeight=742&originWidth=984&originalType=binary&ratio=1&rotation=0&showTitle=false&size=55445&status =done&style=none&taskId=u25346a21-5246-4906-9081- 8132ce93e26&title=&width=629)

点击finish开始下载 下载有点慢
![image.png](https://img-blog.csdnimg.cn/img_convert/a7ad569c22666d7afa3c8f12fb1322a6.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=476&id=uc0ce1166&margin=[object Object]&name=image.png&originHeight=742&originWidth=984&originalType=binary&ratio=1&rotation=0&showTitle=false&size=55132&status=done&style=none&taskId=u8c115e5f-0687-499c-8137-aa9aabc4d52&title=&width=631)

创建一个工程 demo 写一个hello world
![image.png](https://img-blog.csdnimg.cn/img_convert/8f1c0304355d678bd5772bc53dec70c2.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=461&id=ue833f26a&margin=[object Object]&name=image.png&originHeight=605&originWidth=822&originalType=binary&ratio=1&rotation=0&showTitle=false&size=42835&status=done&style=none&taskId=u0b73cc83-68e3-432c-bea1-2fa921d2852&title=&width=626)

Choose a template according to your needs, here is a demo to choose a blank template
! =paste&height=454&id=uffcc609f&margin=[object Object]&name=image.png&originHeight=813&originWidth=1127&originalType=binary&ratio=1&rotation=0&showTitle=false&size=69856&status=done&style=none&taskId=u8e64 a711-974b-490f-bcb2-3377092a173&title=&width=629.5)

Project name, domain name, language, API level, just choose according to your needs
! 0&crop=1&crop=1&from=paste&height=451&id=uf66dd8a0&margin=[object Object]&name=image.png&originHeight=813&originWidth=1127&originalType=binary&ratio=1&rotation=0&showTitle=false&size=57985&status=done &style=none&taskId=u2eb68c13-3c8e-41e7-a835-e66a5a98653&title= &width=624.5)

Since the first installation does not work, you need to configure a new emulator, or use a real machine.
![image.png](https://img-blog.csdnimg.cn/img_convert/f6de193ea6bae089754b3dfcb24499f1.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=69&id=u2e44 ae65&margin=[object Object ]&name=image.png&originHeight=50&originWidth=460&originalType=binary&ratio=1&rotation=0&showTitle=false&size=8401&status=done&style=none&taskId=u09b2e7ca-5aba-4cc3-9564-f8c39aa59ea&title =&width=637)

创建一个新的虚拟设备
![image.png](https://img-blog.csdnimg.cn/img_convert/a19dcc9c38c4b75f572e5d63c92253fd.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=76&id=u6e61f157&margin=[object Object]&name=image.png&originHeight=37&originWidth=241&originalType=binary&ratio=1&rotation=0&showTitle=false&size=5349&status=done&style=none&taskId=ua4b36d7b-f0b0-48d6-96bb-77db4309299&title=&width=496.5)

选择一个型号进行下载
![image.png](https://img-blog.csdnimg.cn/img_convert/e7d8809301a91f8caeb029fdabc72f1e.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=348&id=uce9c6773&margin=[object Object]&name=image.png&originHeight=337&originWidth=255&originalType=binary&ratio=1&rotation=0&showTitle=false&size=36841&status=done&style=none&taskId=ue3238e02-c1f4-4be4-b1b8-ffc9606f456&title=&width=263.5)

![image.png](https://img-blog.csdnimg.cn/img_convert/a82c7139c75fbfb2498ed6c7916207c4.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=462&id=ua5597a0c&margin=[object Object]&name=image.png&originHeight=813&originWidth=1252&originalType=binary&ratio=1&rotation=0&showTitle=false&size=74511&status=done&style=none&taskId=u006dc001-c28c-4e24-8f04-b3198b82ce2&title=&width=712)

![image.png](https://img-blog.csdnimg.cn/img_convert/ca340f68bb351548726d62d4b19dd666.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=499&id=ud3220c7f&margin=[object Object]&name=image.png&originHeight=813&originWidth=1127&originalType=binary&ratio=1&rotation=0&showTitle=false&size=64465&status=done&style=none&taskId=u86daf7c4-16ce-4bfe-9a4e-f6ad6437c90&title=&width=691.5)

![image.png](https://img-blog.csdnimg.cn/img_convert/1cd300196f5b67d1582c489de8657d5a.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=497&id=u7b5837fd&margin=[object Object]&name=image.png&originHeight=813&originWidth=1127&originalType=binary&ratio=1&rotation=0&showTitle=false&size=72572&status=done&style=none&taskId=uc4a6e641-103a-47b1-9ca3-01baff99472&title=&width=688.5)

完成安装
![image.png](https://img-blog.csdnimg.cn/img_convert/cf13a1cdce6ba0e7d38bde8ceb049880.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=361&id=u752ccf62&margin=[object Object]&name=image.png&originHeight=722&originWidth=1484&originalType=binary&ratio=1&rotation=0&showTitle=false&size=47273&status=done&style=none&taskId=ub9615e70-b803-415c-86ee-5b82c6a8fa8&title=&width=742)

运行虚拟设备
![image.png](https://img-blog.csdnimg.cn/img_convert/c57130956b9cc3d9e338e47f5abf36fe.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=688&id=uadc9ba6a&margin=[object Object]&name=image.png&originHeight=835&originWidth=472&originalType=binary&ratio=1&rotation=0&showTitle=false&size=201775&status=done&style=none&taskId=u205e8db3-3bfb-4504-9bc2-e1184fcb84e&title=&width=389)

Run our program and successfully appear hello world

![image.png](https://img-blog.csdnimg.cn/img_convert/aab6ebf259b56e198cf7b19b76fe169c.png#clientId=u236fa0bd-be1f-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=761&id=u9c6df5cf&margin=[object Object]&name=image.png&originHeight=821&originWidth=398&originalType=binary&ratio=1&rotation=0&showTitle=false&size=47201&status=done&style=none&taskId=u59e2bc2c-7d91-4abb-ab41-d77a2e33d91&title=&width=369)

Android SDK download:

![image.png](https://img-blog.csdnimg.cn/img_convert/ecb521fbb0c45f8a3a8af4f6bb7b210a.png#clientId=ud68734b5-1623-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=900&id=uc8f80eee&margin=[object Object]&name=image.png&originHeight=1800&originWidth=2432&originalType=binary&ratio=1&rotation=0&showTitle=false&size=605751&status=done&style=none&taskId=u1ec68b90-6dc6-4491-ba9a-53773efac5a&title=&width=1216)

Configure the Flutter SDK path.

![image.png](https://img-blog.csdnimg.cn/img_convert/b95c186a72efee60b25c6ee917272fbf.png#clientId=ud68734b5-1623-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=900&id=SYQYj&margin=[object Object]&name=image.png&originHeight=1800&originWidth=2432&originalType=binary&ratio=1&rotation=0&showTitle=false&size=399773&status=done&style=none&taskId=u1c23ecdc-1f8e-4aa2-81cd-0c8ba60f2ac&title=&width=1216)

Configure the Dart SDK path.

![image.png](https://img-blog.csdnimg.cn/img_convert/cc2ae60954bfeaef5a6e2522d605edfe.png#clientId=ud68734b5-1623-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=900&id=u1e19fba4&margin=[object Object]&name=image.png&originHeight=1800&originWidth=2432&originalType=binary&ratio=1&rotation=0&showTitle=false&size=307102&status=done&style=none&taskId=u25bd4ed7-5323-4de7-9451-7f369943f86&title=&width=1216)

Plug-in installation:

![image.png](https://img-blog.csdnimg.cn/img_convert/ef7d0baf3a02c3d7d36a68986fd2fd30.png#clientId=u99381fa1-b15b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=368&id=ufecc3b8a&margin=[object Object]&name=image.png&originHeight=559&originWidth=981&originalType=binary&ratio=1&rotation=0&showTitle=false&size=299597&status=done&style=none&taskId=u684a492e-5f01-4457-bf1b-985fffa1c22&title=&width=646.5)
![image.png](https://img-blog.csdnimg.cn/img_convert/8f3fb64b9ae605ecf13d6708b56a8c61.png#clientId=u99381fa1-b15b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=471&id=u480bb07f&margin=[object Object]&name=image.png&originHeight=516&originWidth=709&originalType=binary&ratio=1&rotation=0&showTitle=false&size=197595&status=done&style=none&taskId=u2af7f7b5-2a00-45aa-a462-1755cb1b51c&title=&width=647.5)

Restart after installation

![image.png](https://img-blog.csdnimg.cn/img_convert/256a53879d16a2a45244fc20b3fd5aab.png#clientId=u53ad8cc6-0c5b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=490&id=u2e904c19&margin=[object Object]&name=image.png&originHeight=1134&originWidth=1182&originalType=binary&ratio=1&rotation=0&showTitle=false&size=117092&status=done&style=none&taskId=u85ff90c8-2b31-4c61-b271-76f6ffe228d&title=&width=511)

Guess you like

Origin blog.csdn.net/hzqit520/article/details/126307963