大家好,又见面了,我是你们的朋友全栈君。
使用 Android Studio 搭建安卓开发环境,方便、快捷。因为 Android SDK 等下载已经集成到 Android Studio 的安装中
1、官网下载 Android Studio 编辑器
首先,访问谷歌中国开发者网站下载 Android Studio 编辑器:https://developer.android.google.cn/studio
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
选择要下载的版本
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
下载完成
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
2、进行安装
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
下一步
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
Android Virtual Device,就是Android运行的虚拟设备,简称AVD
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
修改 Android Studio 的默认安装路径,这里读者可根据自己的情况进行选择
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
安装
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
安装完成
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
点击 Finish,会打开 Android Studio 编辑器,进入下面界面
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
这里选择 Do not import settings,点击 OK
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
谷歌要匿名收集一些数据,这里选择不发送
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
这个界面要点击 Cancel,Setup Proxy 是设置代理的意思,这里不设置
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
Android Studio 的安装向导界面,点击 Next
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
安装类型,选择 Custom 定制版,可以修改 sdk 安装目录,如果读者不需要修改,也可选择 Standard 标准版
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
选择编辑器 UI界面主题风格,这里选择了 Darcula
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
修改 Android SDK 安装目录
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
安卓模拟器 RAM 大小设置,这里可根据自己的情况和电脑内存来定,本人使用的电脑是16g内存的,所以设置成了 3.8g
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
全部设置完成后,点击 Finish
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
进行下载
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
下载完成,点击 Finish
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
开始一个新的工程
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
这里选择一个 Empty Activity,即空的界面
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
设置项目名、包名、项目保存路径(即工作区目录)、开发使用的语言、最低API支持
设置完成后,点击 Finish
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
项目一开始,会进行 gradle 构建,受网络影响,某些情况下会比较慢
gradle 的构建过程,会在 C:\Users\Administrator\.gradle\wrapper\dists 文件夹下进行相关版本的 gradle 下载
gradle 构建完成后,文件如下
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
构建完成
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
3、编译打包
构建完成后,点击下图中的 Build Apk(s) 编译打包apk文件
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
打包成功的 APK 文件在项目所在工作区的 app\build\outputs\apk\debug 文件夹下
这里是 E:\AndroidStudioProjects\MyApplication\app\build\outputs\apk\debug
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
将 apk 安装到手机,运行如下图
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
运行效果
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
至此, Android Studio 搭建安卓开发环境成功
读者可能会好奇,为什么什么代码都没写,却有 Hello World! 的文字,原因如下
打开 MainActivity 的代码
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
进入到 R.layout.activity_main 的文件中
![使用 Android Studio 搭建安卓开发环境[通俗易懂]](https://javaforall.net/wp-content/uploads/2020/11/2020110817443450.jpg)
看到这个,读者应该就明白了,这个xml文件在res,layout 文件夹下
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/125381.html原文链接:https://javaforall.net
