Android Studio Tutorial-Create your first project Hello World

Source: Internet
Author: User

The original text in my blog:/http www.qiuqiu77.com/android-studio-hello-word.html

In the previous article on the deployment of the Android development environment, we greeted it with Hello World and Android Studio!


The first step is to open Android Studio

Enter your project name "Hello World".
"Company Domian": For the time being, just fill it out!
"Project Location": You should create a new directory where the proper names are used for Android projects. Point this project location to your directory.
The second step, "Target Android Devices", is the default.
In the third step, we will choose an empty activity!

The fourth step, "Custom the Activity", is the default. Click "Finsh".

After clicking "Finsh", don't worry, wait a few seconds for Android studio to configure the project. This will pop up.

After loading into the project, you need to initialize something. You can see it at the bottom of Android studio.

Finally, the page is like this.

Hello world! Hello to you,the first app runing.

The project was created successfully, if you think the interface doesn't look very comfortable. Then you can adjust the directory, and the font.

Adjust catalog display

Here you can switch to the following directory display, I prefer the default Android display directory. You can also switch to project display mode and so on.Adjust font style(1) Click File->settings to enter the settings screen of Android studio.

(2) Click editor->colors & Font to set the font style and you will find out how not to modify it. You need to click "Save As ..." to save the font, enter your font style name (MyFont is the font style name I set, this can be whatever you like), and then in scheme Select the font style you just saved, you can choose your font style and font size, click " Apply ". (3) In the previous step we adjusted the code style, and the fonts in your Android studio window did not change. If you want the font of the window to also change, just settings the window, click Appearance & Behavior >appearance. Then check "Override default fonts by" In the UI options to choose your preferred font and size.

Run the project

Running the project will use several of the figures in Figure 01-01.

Select a Run/debug configuration

Run the project

gradle Synchronization When you run the project or change the Gradle configuration, you have to click this button, will download the corresponding dependency

AVD Manager Emulator Management

The SDK Manager is managing your SDK version

DDMS is the Dalvik Debug Monitor Service,dalvik Debug monitoring service.

There are two ways to run a project: Run with your Android phone (recommended) with Android Emulator (Android phone simulator), which is a bit of a card, of course, the computer configuration is very good to ignore. Click App>edit configuartions and the "Run/debug Configurations" window appears to select how you want to run the project.

Figure 01-01 in the "Run/debug Configurations" window, in "Deployment Target options>target" select "USB device" is USB connection to Android phone or tablet and other devices to debug " Emulator "simulator" Show Device Chooser Dialog "Select the debug mode each time you run."

Mobile phone Running project(1) Connect the phone with the USB connection computer (2) tick "Start debug mode after connection", note not to open the USB storage device. If this is the first time, the computer will pop up a dialog box and need to install something. (3) Click Run, eject the device dialog select box, select the connected devices, click OK.

Wait patiently for a moment and you'll see the Hello World interface on the phone.

Emulator Run ProjectBefore creating the simulator, click on "SDK Manager, update the SDK update, especially" Android SDK Build Tools ", I just because this is not updated, the results reported a timeout of 300m error.

(1)Create simulatorA. Click the "AVD Manager" button and the "Android Virtual device Manger" window appears, click on Create Virtual Appliance emulator. B. Select the device and I'll select the default phone Nexus 5X.

C. Click "Next, Go to the" Select Image "Window interface, select the system version, the most common default selection of the highest version. (now the highest is Android 6.0) d. Click "Next" to enter the "AVD Verify Configuration" Window interface, which is generally not modified, is the default. Note phone size scale is typically set to auto, automatically configured size. Click "Finsh". E. Wait a moment, and we'll see that the simulator is created.

(2) The simulator is created, so let's run the project with the simulator! Click "Run App" pop-up to select the window that runs the device, we see the simulator "Nexus 5X API23" we just created.

(3) Click "OK" to run, you can see the operating status of Android studio at the bottom of the display. After that, wait patiently for the simulator to appear! You can take advantage of this time to drink a glass of water.

(4) Success, that's it.

Now that Android Studio has created the first project, we can learn more about the shortcut keys for Android Studio or to learn about the Gradle of Android Studio

Android Studio Tutorial-Create your first project Hello World

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.