Android training–android Studio

Source: Internet
Author: User

Started to learn Android development again, I hope this is not three minutes of heat. Previously developed using Eclipse+adt, the official web site is recommended for Android Studio. The system was just re-installed and the memory was upgraded. So the next studio to learn.

The goal is to successfully run a Hello World program on your phone and review what you learned before.

first, using Android studio to build the environment

1. Download the JDK and install

Refer to Previous Blogs

http://blog.csdn.net/h2008066215019910120/article/details/41308783

2. Download Android Studio

Baidu Network Address

http://pan.baidu.com/wap/link?shareid=1681502988&uk=1712131560&third=0&dir=%2F%E5%BC%80%E5%8F%91% 2fandroid-studio%2f1.1&page=1

PS: It is best to choose the default path to install, or it may be wrong.

3. Using the SDK Manager

Download SDK after installing studio, open the SDK Manger Download SDK. Pay attention to configuring the agent, otherwise there is no speed. Proxy configuration reference:

http://blog.csdn.net/h2008066215019910120/article/details/41308783

Second, create a project

With the previous foundation, this should not be difficult, in the corresponding place to fill in the corresponding information can be.

1. Fill in the information

The main application name, the company name (you can not use the default), the package name, the project location.

2, select the device to run the app, generally choose phone and Tablet.

3, the lowest version of the SDK, the lower the choice, the more the support of the device is perfect.

4, select Add Activity to template, select blank activity.

5. Name some files including activity name, layout name, Menu Resource name, etc.

6. Click Finish to continue.

Such a project is created and can be run without adding any code.

iii. files for projects generated by Android Studio

1, App/src/main/res/layout/activity_my.xml

The default generated XML layout file, whose name is related to the previous setting. Android Studio has two ways of showing a preview of text and screen UI, respectively. The default generated XML file contains some settings and a message "Hello world! ”

2, App/src/main/java/com.mycompany.myfirstapp/myactivity.java

The class definition for activity. When you create and run the app, the activity class runs the activity and imports the layout file.

3, App/src/main/androidmanifest.xml

The manifest file despises the basic features of the app and defines each part of it.

4, App/build.gradle

This is a critical part of Eclipse, and Android Studio uses Grad to compile the app. There is a build.gradle file for both your project's module and the entire project. This file is set up for your compilation dependency. Contains some of the default configuration information.

+ compiledsdkversion

This is the version of the target SDK that your app compiles, which is usually the latest in the SDK that you have.

+ ApplicationID

The package name that is set when the project is created.

+ minsdkversion

The minimum SDK version specified when the project was created.

+ targetsdkversion

The highest SDK version your app wants to test.

Gradle still have a lot to learn, to be in depth.

5./res Folder

This folder is all the resources you need for your application.

+ drawable<density>/

The Image resource folder, which contains a variety of pixel levels. Ic_launcher.png is the icon for the program.

+ layout/

Defines the folder where the layout files are applied.

+ menu/

menu-related definitions.

+ values/

In addition to some of the above resources such as string and color definitions.

Four, run the app

Running on the phone, now Android phones should be very popular. Install the driver, the next pea pod or some other assistant to install. Remember to uninstall after installation.

on the phone, set developer options to allow USB debugging. After the device detected by Android Studio, click Run.

Android training–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.