Android Studio2.0 tutorials from entry to proficient in MAC
Preface
In this tutorial, you will learn how to use Android Studio2.0 to develop Android applications. From installation to development of Hello World, you will be explained in illustrated ways. I hope this will help you learn how to develop Android Studio, I hope you will criticize and correct what you don't understand or make a mistake.
What will you learn
- Android Studio Installation
- Android SDK Configuration
- Simulator Installation
- Develop your own applications
- How to debug an application
- Some essential skills
What do you need to prepare?
- A mac Machine
- Test devices with Android Versions greater than or equal to 4.0 (no simulators can be used)
- Familiar with JAVA
Are you ready? Let's learn and make progress together. Let's get started !!!
Introduction
At the 2013 I/O developer conference, Google officially announced that Android Studio will serve as the main IDE for Android development. It is a specialized Android development Artifact Based on IntelliJ IDEA. Google, a developer who has been using ADT (Android Development Tools), suggested to switch to Android Studio. The official website also announced that the ADT will not be updated. Adnroid Studio supports Windows, MAC, Linux, and other operating systems.
System Requirements
- Mac®OS X®10.8.5 or higher
- The minimum memory is 2 GB. 4 gb ram is recommended.
- 2 GB hard disk
- Java Runtime Environment (JRE) 6 or higher
- Java Development Kit (JDK) 7 or higher
Download
It is recommended for beginners to download the installation version. It is easier to install the version one by one. You can also download the Green Edition for beginners. The green version is divided into Canary version, Dev version, and Beta version. It is recommended that the Canary version be relatively stable.
Official download (Scientific Internet access required)
Installation: http://developer.android.com/sdk/index.html
Http://tools.android.com/recent Green Edition
Install
JDK should have been installed on the mac machine. You can enter "java-version" in the terminal to check the Java version. if the version is too low, you can download Java SE Development Kit 7.
Install Android Studio with the installation version
1. Open the downloaded. dmg file.
2. Drag Android Studio to Application
3. When Android Studio is started, the first time the system prompts that the Android SDK is not found:
4. Click Next to install the Android SDK:
Many people are stuck in the SDK download process. The download speed is extremely slow due to the reasons of the wall. You can try the "offline download" function of Baidu online disk, which allows you to download the SDK in seconds, and then download it from the online storage to the local device. This will be much faster!
Another way is to use "Thunder" to download the file. I can use thunder to download the file quickly.
After the download is complete, you can refer to the following "Android SDK manual download configuration" to install the SDK.
SDK download: https://dl.google.com/android/android-sdk_r24.4.1-macosx.zip
Install Android Studio in green
1. decompress the Zip package with the decompression software (here I use BeeterZip ).
2. Cut Android Studio to Application in the Finder.
3. Start Android Studio. The welcome page is displayed first. Click Next to go to the Next step:
4. Install the Android SDK. Select the desired API and click Next to download the SDK.
Wait until the SDK download is complete. If this step takes too long, you can refer to the following "Android SDK manual download configuration" step.
Android SDK manual download configuration
1. Download
Http://dl.google.com/android/android-sdk_r24.4.1-macosx.zip (Scientific Internet needed)
(For the fully packaged version, skip the steps 2-5 below)
2. decompress the downloaded zip file ~ /Library/Android/sdk directory. The directory structure is as follows:
3. Run sdk/tools/android to start Android SDK Manager
The Fitch fail URL or Nothing was installed error is often encountered during Android SDK update and download in China. To solve such errors and increase the download speed, you can set an http proxy. Press the Cmd + shortcut to open the Setting interface or press the method to open the Setting interface.
Settings:
- Http Proxy Server: mirrors.neusoft.edu.cn
- Http Proxy Port: 80
- Select the "Force https: //... sources to be fetched using http: //..." check box
4. Download four essential packages:
By default, the SDK Manager automatically selects the required update or installs the SDK. You can skip this check.
5. Accept the related license and start install.
Note: You must accept all project licenses in the list on the left, and then start install.
A download failure may occur during the download process. You can download it again several times. Make sure that the following installation is complete:
6. Start Android Studio to configure the Android SDK path
If you are prompted that the Android SDK is not found, click the cancel button:
Basic configurations of Android Stuido
You can use the shortcut key [Cmd +,] or [Preferences...] to open the Android Stuido Configuration window.
Topic Configuration
You can set it to the currently popular Darcula topic through the UI Options under Appearance & Bahavior> Apperance.
Font configuration
The default Font size is too small. You can set the Font size based on your needs by using Editor> Color & Fonts> Font.
The default scheme is read-only. Save As before modifying the font size. Then modify the font:
Show Code lines
By default, Android Studio does not display the number of lines of code. In this way, it is inconvenient to locate the XX line errors. In the configuration query window, enter the line num keyword to query the project to be configured, then select the Appearance option. You can see the Show line numbers option. You can check the box.
Simulator Installation
The AVD Manager in Android Stuido can be used to create simulators. It is also relatively simple to use, but its performance is not good. Now Genymotion is popular, and it is called the fastest Android simulator in history. Next we will install Genymontion.
Install Virtual Box
Click here to open the Virtual Box download page and click Download amd64:
After the download is complete, open the dmg file and double-click the VirtualBox icon to start Virtual Box installation. The installation process is very simple and basically the Next step.
Registered User
Click here, enter the user name, email address, and password on the page, and accept the agreement to register the user.
Download Genymontion
Click here to open the Download page and click the Download button to start Download.
Install Genymontion
Open the genymotion-2.6.0.dmg file and drag Genymotion and Genymotion Shell to Apptions.
Install Genymontion
Open Property settings in Android Studio, find Plugins, and Click Browse Repositories:
In the search box of the Browse Repositories window, enter Genymotion. After the query result is displayed, click the install button to install the plug-in:
After Genymotion is installed, Android Studio prompts you to restart. After restart, you can see the Genymontion icon on the toolbar.
If you click the Genymontion icon for the first time, the Genymontion setting is displayed. Click the... button in the setting to specify the location of the Genymontion application (default location:/Applications/Genymotion. app ).
After the path is set, click the Genymontion icon to open Genymontion Device Manager.
Note: If the message "Genymontion: Initialize Engine: failed" is displayed, check whether the Virtual Box works properly.
Click New in Genymontion Device Manager to create a New simulator.
In the create wizard, log on to Genymontion and click Sing in to log on.
After successful login, you can see the list of available simulators with different models. You can find the simulator you want to create through the version and device model. Next, wait until Genymontion downloads the simulator.
After the download is complete, the next task is very simple. When you use it, you only need to start the simulator and ensure that the simulator status is On.
Android Studio detects the Genymotion simulator during running. Click OK to compile and install the application.
I have been using a real machine for development in the past. I tried Genymontion and felt that the performance was indeed good. That is, I had to log on to install the simulator. Sometimes I may fail to log on, this is the only thing that feels uncomfortable. After the simulator is installed, it has nothing to do with logon and can be used normally when the network is disconnected.
The entire installation process of the Genymontion simulator is complete. Take a rest !!!
For more details, please continue to read the highlights on the next page:
[Content navigation] |
Page 1st: Installation |
Page 2nd: Entry |
Page 1: Improve |
|