Create an Android project using Android Studio

Source: Internet
Author: User

Create a project

First, in Android Studio: Project and module, the real meaning of project is the workspace, module for a specific project.

In eclipse, you can simultaneously edit multiple Eclipse project at the same time, and these project are in the same workspace. In Android Studio, we can simultaneously edit several module of Android studio, which are in the same Project.

Project Eclipse is the same as the Module for Android studio. Eclipse's workspace is equivalent to Project in Android studio.

The item mentioned in this article refers to the Module of Android studio. Android Studio creates a project that starts with Project first. But as you create the project, Project automatically creates it.

The process of creating a project in Android Studio is actually a subdivision of Eclipse's process of creating a project. Eclipse Many of the content set on one page, Android studio split into multiple pages, so the process of creating a project is not complicated.

There are two ways to create a project in Android studio. The first one is to select Start a new Android studio project on the Android Studio start Page

The second one is on the Android Studio home page, select File---New Project


Next, we'll see this page.


Application name: The names of the applications. It is the app name that the app displays on the device, and also the name of the Android Studio Project.
Company domain: Corporate domain name. Affects the following package name. The default is the computer host name, and of course you can set the package name separately.
Package Name: the application bundle name. Each app has a separate package name, and if two apps have the same package name, Android will think they're the same app. As a result, it is necessary to ensure that different apps have different package names.
The local directory where Project Localtion:project resides.

After setting up the above content, click Next.

Next, we'll see this page.

Here you can type the Module in your Project and the minimum supported version. 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 Module is a Google Glass project (do not know what Google Glass is, please search by yourself).

You can select multiple types at the same time, and the difference is that the project creates one or more Module based on the type you choose.

The Minimum SDK represents the minimum Android version supported by the Module. Different versions can be selected depending on the user. You can click on the Help me choose to see the current version of Android distribution. Now in this era, if your project supports the 2.2 version almost all Android devices are supported.

After setting up the above content, click Next.

Because my Module type only has Phone and Tablet selected, this page

This page is the type that lets us choose whether to create activity and create activity. You can choose not to create activity (Add no activity).

If you choose to automatically create Activity,android studio, it will automatically generate some code for you. The generated code is different depending on the Activity type. Sometimes you can learn a lot from these automatically generated code, such as Fullscreen Activity. Select Finish, click Next.

In the previous step, I chose the Blank Activity, so I will see

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.

After setting up the above content, click Next. You will see this progress bar. This means that Android studio is creating and compiling your project.

After the project is created and compiled, it will go to the home page of Android Studio and you will see the following interface.

On the left is your project file area, the middle is the code area, and the right side is the preview area of the layout file.

If you are careful, you will find that the file level shown in the project file area on the left is not the same as Eclipse, or even the file hierarchy of the local directory. It's not the same as eclipse because Android Studio uses the Gradle project build tool, and Eclipse uses Ant build projects, and you can have the same directory structure through Gradle settings and Eclipse. And the file level of the local directory is different because, after the Android Studio 0.8 version, the official recommended use of Android file directory display structure, you can switch. In the upper-left corner of the project file area, you can select the type of file structure display you want to select.

Although the official recommendation is to use Android, I personally prefer to use Project. You can choose according to your personal habits. The following are the display differences between the two display types: Android and project.

As can be seen from these two graphs: Android is clearly differentiated, showing only the files related to the project; project shows the structure of the file according to the local directory structure, which is more complicated but shows the real directory structure.

In addition, I have two settings for the project file area. In the upper-right corner of the project file area, there is a gear settings button that allows you to click on the settings file to display the results in more detail.

The default is not to tick Flatten Packages and AutoScroll to Source, is my own tick. 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. If you already have a project where you want to create a Module in this project, you can choose File-to-New module.

This creates a Module in the current directory instead of creating the Project and Module separately in a new window. After that, you'll see the following interface.

Similarly, you can set the project type, but since you are now creating a Module, you only have to choose one type.

The 4 options below represent different meanings: Android Library: Create a Module for the Android library. Import Existing Project: Importing another project as a Module, the imported project can be an Eclipse ADT project, or it can be a Gradle project (Gradle is just a project builder, which is also available in eclipse). Import. JAR or. AAR package: Import a JAR or AAR file as a Module. Java Library: Create a Java Module that is used primarily to write Java toolkits.

Select Finish, click Next. The rest of the steps, almost the same as above

Create an Android project using Android Studio

Related Article

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.