Android Studio installation and configuration detailed steps, as well as basic operations

1. Android SDK download and installation

    If a suitable version of the Android SDK already exists locally, there is no need to download it, or you can use the SDK Manager to update the SDK;

     If you don’t have SKD, you need to download it. In fact, during the installation of Android Studio, you will choose to download the latest SDK installation, but the speed is extremely slow. I am used to downloading the SDK first and then configuring it after installing Android Studio (of course, this is just me Personally, you can install the SDK directly during the installation of Android Studio).

    Here's how to use the SDK Manager to download/update the SDK:

    (1) If the SDK Manager is not installed, you can download and install it at the address https://github.com/inferjay/AndroidDevTools#sdk-tools. After downloading, just run the installation directly. During the installation process, it will automatically match the local environment. jdk; enter the installation directory:

    (2) Start SDK Manager.exe, as shown below:
----------------------------------


2. Download and installation of Android Studio, as well as new project and debugging operation

        Since the official website address http://tools.android.com/download/studio cannot be downloaded, I directly searched Baidu to download it (I don’t know if it is possible, but it works fine anyway).

        In addition, a domestic mirror download address https://github.com/inferjay/AndroidDevTools is provided.

        After downloading, if it is an installation package, you can install it directly; if it is an unzipped package, you can unzip it and run it directly (the studio.exe file in the installation directory).

        During the installation process, since the SDK has been downloaded before, the installation of the SDK is skipped and continues until finish. Run to open Android studio, then manually configure the SDK, click SDK Manager, and configure the path of the downloaded SDK, as shown below. :

    After configuring the SDK, you can create a new project, as shown in the following series of pictures:

(1)file-->new-->new Project:

(2) next-->You can choose the version of the project you created-->If you don’t know the version, you can click help me choose:

(3) After clicking help me choose, the current version information of the Android system will be displayed. What else is unclear! (Just looking at the interface UI is great)

(4) After selecting the version, next-->enter the main Activity style selection interface. Here are just a few, there are many styles:

(5) Continue next-->until finish, then the creation of the project is completed. The creation process will be a little longer and you need to wait (complain about the computer provided by the company, the configuration is super poor, I want to smash it every minute!!)
 

(6) The following is the completed project interface. Click the run icon in the toolbar above to run. There is log information in the logcat below. These are similar to Eclipse and will be very easy to use, so I won’t elaborate further.

        The following article will introduce in detail the common differences and unique advantages between Android Studio and Eclipse.

3. Android Studio project directory structure

    When we create a new project, the directory structure defaults to this:

    You can see that the directory structure is very different from that of Eclipse. Android Studio can only have one project in a window, while Eclipse can have many projects at the same time. If you are not used to it, you can click the Android robot in the upper left corner to switch:

    After switching "Android" to "Project", as shown below:

    It feels like this is very similar to the structure in Eclipse.

    In general, the differences from Eclipse are as follows:

    1. There are concepts of Project and Module in Android Studio. As mentioned earlier, a window in Android Studio can only have one project, that is, a Project, which represents a workspace, but a Project can contain multiple Modules, such as the Android Library referenced by your project. , Java Library, etc., these can be regarded as a Module;

    2. In the above directory, the java code and resource files (pictures, layout files, etc.) are all classified as src. There is a main group under the src directory, and two folders, java and res, are divided into two. The java folder is equivalent to The src folder and res directory structure under Eclipse are the same.

    Regarding the project directory structure, you just need to get used to it. There is no need to say too much. Next, let’s talk about other uses of Android Studio.

    3.Main files and directories:

    (1) settings.gradle: Each Moudle must be registered here. You can open the file and take a look and you will understand;

    (2) build.gradle: Configuration of each Project

    (3) app: each Module

    (4) app/build.gradle: Each Module configuration file, such as dependent class libraries and SDK versions

    (5) app/src/: Source code and resource files are all here; the files we write are all here.

    (6) app/libs/: Add class library.

4. Basic use of Android Studio

    The reason why Android Studio feels so useful after using it is because there are many places that are more convenient to use than Eclipse and are very easy to use. Take a look at the following points:

1. Android Studio does not need to save manually, it has an automatic saving function;

2. The "TODO" view shows the current position in the program very well;

3. There are Logcat, Memory and other interfaces in the Android Monitor view, and Logcat is also very convenient to use;

4. Compared with Eclipse, the most distinctive feature of Android Studio is the built-in "Terminal". For Android developers, this is much more convenient than opening a separate cmd, and it is particularly comfortable to use;

5. There are several commonly used functions on the right side of the Studio menu bar, as shown in the figure: Gradle synchronization, AVD Manager, SDK Manager, and DDMS:

(1) Gradle synchronization. When running your project or changing the Gradle configuration, click this button and the corresponding dependencies will be downloaded.

(2) AVD Manager emulator management

(3) SDK Manager is to manage your SDK version

(4) DDMS is Dalvik Debug Monitor Service, Dalvik debug monitoring service.

5. Commonly used shortcuts in Android Studio

Global shortcut keys (more important)    
Shortcut keys in Eclipse
ALT + ENTER Quick repair of projects CTRL + 1
CTRL + SHIFT + A Quick search    
CTRL + ALT + L
Format code CTRL + i
CTRL + Q
View document Mouse automatic
SHIFT + ESC when switching When it is not an editing area, close the area and return to the editing area. Editing area    
shortcut key    
CTRL + B / F4

or this Ctrl + click (applicable)

View the source code
ALT + INSERT insertion method (construction method, Get Set method, etc.), create a new file in the project structure


ATRL + / Contextual association
ALT + LEFT / RIGHT Switch left and right between different documents
ALT + TOP / BOTTOM Jump to the previous / next method
Comment    
CTRL + / Focus on the current line
CTRL + SHIFT + / Focus on the document Copy
/Paste    
shortcut keys in Eclipse
CTRL + C Copy     the line
CTRL     +
V     Paste    
CTRL + Find class (class) Ctrl + SHIFT + N Find files






六.Android Studio VS Eclipse

    I believe that most people in China currently use Eclipse, so first let’s talk about some of the advantages of Studio. Comparison will be more convincing and explain why we need to migrate from Eclipse to Studio.

    1. Launched by Google

There is no doubt that this is its biggest advantage. Android Stuido is launched by Google and is "tailor-made" for Android. It is an IDE based on IntelliJ IDEA that is strongly supported by Google. This should explain why it is Android. s future

    2. Faster

Eclipse has been criticized for its startup speed, response speed, and memory usage. I believe everyone has a deep understanding of this and often encounters a stuck state. Studio is ahead of Eclipse in every aspect

    3. The UI is more beautiful

The black theme demonstrated at I/O is really great, for geeks, the cool black interface of Stuido’s own Darcula theme is really classy. In comparison, the black theme under Eclipse is too low.

    4. Smarter

Prompt completion is of great significance to development, and Studio is more intelligent and saves intelligently, so you no longer need to press Ctrl + S every time. Once you become familiar with Studio, your efficiency will be greatly improved.

    5. Integrated Gradle build tool

Gradle is a new build tool. Gradle has been supported since the debut of Studio. It can be said that Gradle combines the advantages of Ant and Maven. It is very good in terms of configuration, compilation and packaging.

    6. Powerful UI editor

The editor of Android Studio is very smart. In addition to absorbing the advantages of Eclipse+ADT, it also comes with real-time preview of multiple devices. This is an artifact for Android developers.

    7. Built-in terminal

Studio has a built-in terminal, which is great news for people who are accustomed to command line operations. They no longer have to switch back and forth, and one Studio can handle it all.

    8. A more complete plug-in system

Studio supports various plug-ins, such as Git, Markdown, Gradle, etc. If you want any plug-in, just search and download it.

    9. Perfect integration with version control system

When installed, it comes with popular version control systems such as GitHub, Git, SVN, etc., so you can check out your project directly.
----------------------------------

Guess you like

Origin blog.csdn.net/weixin_59165792/article/details/127044718