Installation and basic use of Android Studio

Source: Internet
Author: User
Tags version control system git commands

1. Installation

The third and fourth are virtual machine related, which must be checked on the computer using the virtual machine.



Android Studio requires VC + + environment to run, the Android studio installation process will be installed automatically.

2. Run as
The prerequisite is to correctly set the Java java_home environment variable, as the operation needs.

During the startup process
You did not install the second one before, or import the previous configuration file.

Check the SDK here, slow may be a network problem, generally need a time, host to modify. Updates are updated after the check is required.



Choose the second automatic customization here, because you can specify that the directory for the SDK is not in C drive.



Download the SDK

Download complete display screen from top to bottom: 1. Create an Android studio project; 2. Open a ... 3. Import the sample; 4. Import the code from the version control system. Supports CVS, SVN, Git, Mercurial, and even github;5. Import non-Android studio projects. Like the pure Eclipse Android project, Idea Android project; 6. Settings; 7. Documentation;
Set up a JDK or Android SDK directory
Configure--Project Defaults--Project Structure
I've set the right here.

3. Simple Setup1. Modify the interface theme Settings---appearance-Theme;
2. Font settings system font: Settings-appearance, tick Override default fonts by (not recommended), select a support Chinese Font is available. Suggested Microsoft Jas; Programming Fonts:Settings-Colors & Fonts--and Font. The default system display Scheme is Defualt, is not editable, click on the right side of the Save as ... ,Save a copy of your settings and set them in. You can then set the font in the Editor font. Show only monospaced fonts indicates that only the equal-width font is displayed,generally speaking, the programming and other wide font use more, and the effect is better. Recommended3. Default file Encodingfor character compatibility issues, we recommend that you use Utf-8. China's Windows computer, the default character encoding is GBK. Settings---File encodings. It is recommended that you set the IDE Encoding, Project Encoding, Properties fiels to a uniform encoding.
4. Shortcut keys Settings--Keymap 5. Show line Numbers Settings----and appearance, check show lines numbers.
6.Git for version controlIf you use Git for versioning, you'll need to set up Git's installation file directory. Settings--and Version Control--git, select your git installation directory on the right.
7. Plug-in Settings-Plugins
8. Automatically check for updatesSettings to Updates. Tick check for update in channel, which automatically checks for updates. You can disable automatic check for updates. The list on the right is the update channel. Stable Channel: The official version, only the latest official version is available.
9. Importing packages automaticallyyou copied a piece of code from somewhere else into Android studio, the default Android studio does not automatically import references to the classes used in this code. Settings to Editor-to-Auto Import, tick the ADD unambiguous improts on the fly.
4. New Project
The first thing you know: Project Eclipse is the same as the Module for Android studio. Eclipse's workspace is equivalent to Project in Android studio.Phone and tablet: Indicates that the Module is a phone and tablet project.
TV: Indicates that the Module is an Android TV project.    Wear: Indicates that the Module is a wearable device (such as a watch) project. Glass: Indicates that the Module is a Google Glass project
Let's choose whether to create an activity and create the type of activity.

Activity Name: The class name of the activity that was created automatically. Layout Name: The configuration file name of the Activity that was created automatically.    Title: The name of the Activity that was created automatically.         Menu Resource Name: The menu file name of the Activity that was created automatically. It's not the same as eclipse because Android Studio uses the Gradle project build tool, and Eclipse uses ANT to build the project.
Can be done by Gradlesettings and Eclipse have the same directory structure. Officially recommended for Android, choose Project as Eclipse.

There are two settings useful: Flatten Packages is set to display the package in the form of a full package name (personal habits).        AutoScroll to Source is when you click on a file that will open automatically, eliminating the double-click operation. Just so created a workspace equivalent to eclipse created together with the project you can also create a new module,file->new Module in the current workspace.
5. Import the Project  Android Studio uses Gradle to build projects by default, and Eclipse uses Ant to build projects by default. It is recommended that Android studio build the project using Gradle when importing the project.

There will be one more file, the file is recognized as the, first upgrade ADT to the latest version (note that the ADT-related components should be upgraded together to avoid any later errors). Then I specify the target path, I put it in my as workspace, this is an empty folder, and after the import the folder becomes a project, the original Eclipse project becomes the module inside.
6. Basic use
   Compile the module shown in the right module list from left to right, the module list for the current project, the module shown in the module list on the left, and the mo shown in debug left module list Dule; Attach debugger to Android process; setup; project structure;compiling project with Gradle;virtual machine; SDK Manager; DDMS.
Delete module:
After clicking the minus sign, right-clicking the module will cause the Delate option to appear. This allows you to control the module and add a reference package.
As through Gradle to manage module.

Version control:When you create a project in Android studio, there is no version control by default. If you want to version the project, you can set this up. VCS---Enable Version Control integration.          Set the GitHub user name and password inside the settings.   Sets the git executable file address. In this way, you can use git commands:

Common shortcut keys:
CTRL + Q: View the corresponding document.       CTRL Click Keywords: View source code.       CTRL + TAB: Switch between different code.       CTRL + SHIFT + ENTER: Complete the rest of the code.       CTRL + Alt +t: POPs the enclosing structure, such as if.        CTRL + J: Smart cue template, such as for loop. Reference: Http://ask.android-studio.org/?/explore/sort_type-new__category-8__day-0__page-2





From for notes (Wiz)

Installation and basic use of Android Studio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.